home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Jumpstart / Multimedia Microsoft Jumpstart Version 1.1a (Microsoft).BIN / develpmt / examples / infobrws / src / playvfw.bak < prev    next >
Encoding:
Text File  |  1993-07-19  |  88.2 KB  |  3,129 lines

  1. //     (C) Copyright Microsoft Corp. 1991.  All rights reserved.
  2. //
  3. //     You have a royalty-free right to use, modify, reproduce and 
  4. //     distribute the Sample Files (and/or any modified version) in 
  5. //     any way you find useful, provided that you agree that 
  6. //     Microsoft has no warranty obligations or liability for any 
  7. //     Sample Application Files which are modified. 
  8.  
  9.  
  10. /****************************************************************************
  11.  
  12.     MODULE    : PLAYVFW.C
  13.  
  14.     PURPOSE   : Calls into the DLL sndply.  Demonstrates that MCI functions
  15.         can be called from a DLL.
  16.  
  17.     FUNCTIONS :  About
  18.          PlayVFWInit
  19.          PlayVFWWinProc
  20.          WinMain
  21.  
  22.  
  23.     COMMENTS  : This program implements playing VFWfiles using the DLL
  24.         sndply.
  25.  
  26.     HISTORY   :
  27.  
  28. ****************************************************************************/
  29.  
  30. #include "windows.h"
  31. #include <stdlib.h>
  32. #include "playvfw.h"
  33. #include "proto.h"
  34. #include "mmsystem.h"
  35. #include <digitalv.h>
  36.  
  37.  /****************************************************************************
  38.  
  39.     FUNCTION  :  About( HWND, unsigned, WORD, LONG )
  40.  
  41.     PURPOSE   :  This function processes Dialog Box messages associated with
  42.          the about dialog box.
  43.  
  44.     COMMENTS  :
  45.  
  46.  
  47.     HISTORY   :
  48.  
  49. ****************************************************************************/
  50.  
  51.  
  52. BOOL FAR PASCAL About( hDlg, message, wParam, lParam )
  53. HWND hDlg;
  54. unsigned message;
  55. WORD wParam;
  56. LONG lParam;
  57. {
  58.     if (message == WM_COMMAND) {
  59.     EndDialog( hDlg, TRUE );
  60.     return TRUE;
  61.     }
  62.     else if (message == WM_INITDIALOG)
  63.     return TRUE;
  64.     else return FALSE;
  65. }
  66.  
  67.  
  68. void PlayVFWPaint( hDC )
  69. HDC hDC;
  70. {
  71.     HANDLE hLibrary;
  72.     FARPROC lpfnUpdateVFW;
  73.     HDC hTempDC;
  74.     DWORD dwBackColor;
  75.  
  76. // Set the Background color to black.
  77.  
  78.      SetBkColor(hDC,RGB(255,255,255));
  79.  
  80.  
  81. return;
  82. }
  83.  
  84.  
  85. /* Procedure called when the application is loaded for the first time */
  86.  
  87. BOOL PlayVFWInit( hInstance )
  88. HANDLE hInstance;
  89. {
  90.     PWNDCLASS   pplayvfwClass;
  91.     PWNDCLASS   pVidWinClass;           
  92.     
  93.     /* Load strings from resource */
  94.     LoadString( hInstance, IDSNAME, (LPSTR)szAppName, 10 );
  95.     LoadString( hInstance, IDSABOUT, (LPSTR)szAbout, 10 );
  96.     MessageLength = LoadString( hInstance, IDSTITLE, (LPSTR)szMessage, 25 );
  97.                                                                   
  98.     // set up a class without a menu.                                                              
  99.                                                                   
  100.     pplayvfwClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
  101.  
  102.     pplayvfwClass->hCursor      = LoadCursor( NULL, IDC_ARROW);
  103.     pplayvfwClass->hIcon          = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
  104.     pplayvfwClass->lpszMenuName =   NULL;
  105.     pplayvfwClass->lpszClassName  = (LPSTR)szAppName;
  106.     pplayvfwClass->hbrBackground  = (HBRUSH)GetStockObject( BLACK_BRUSH );
  107.     pplayvfwClass->hInstance      = hInstance;
  108.     pplayvfwClass->style          = CS_HREDRAW | CS_VREDRAW;
  109.     pplayvfwClass->lpfnWndProc      = PlayVFWWndProc;
  110.  
  111.     if (!RegisterClass( (LPWNDCLASS)pplayvfwClass ) )
  112.     /* Initialization failed.
  113.      * Windows will automatically deallocate all allocated memory.
  114.      */
  115.     return FALSE;
  116.  
  117.     LocalFree( (HANDLE)pplayvfwClass );            
  118.     
  119.     pVidWinClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
  120.  
  121.     pVidWinClass->hCursor      = LoadCursor( NULL, IDC_ARROW);
  122.     pVidWinClass->hIcon          = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
  123.     pVidWinClass->lpszMenuName =   NULL;
  124.     pVidWinClass->lpszClassName  = (LPSTR)"VidWin";
  125.     pVidWinClass->hbrBackground  = (HBRUSH)GetStockObject( WHITE_BRUSH );
  126.     pVidWinClass->hInstance      = hInstance;
  127.     pVidWinClass->style          = CS_HREDRAW | CS_VREDRAW;
  128.     pVidWinClass->lpfnWndProc      = VideoWndProc;
  129.  
  130.     if (!RegisterClass( (LPWNDCLASS)pVidWinClass ) )
  131.     /* Initialization failed.
  132.      * Windows will automatically deallocate all allocated memory.
  133.      */
  134.     return FALSE;
  135.  
  136.     LocalFree( (HANDLE)pVidWinClass );
  137.     return TRUE;        /* Initialization succeeded */
  138. }
  139.  
  140.  
  141.  
  142. int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow )
  143. HANDLE hInstance, hPrevInstance;
  144. LPSTR lpszCmdLine;
  145. int cmdShow;
  146. {
  147.     MSG   msg;
  148.     HWND  hWnd;
  149.     HMENU hMenu;
  150.     HMENU hMyMenu;
  151.     FARPROC lpfnPlayVFWFile;
  152.  
  153.     if (!hPrevInstance) {
  154.     /* Call initialization procedure if this is the first instance */
  155.     if (!PlayVFWInit( hInstance ))
  156.         return FALSE;
  157.     }
  158.     else {
  159.     /* Copy data from previous instance */
  160.     GetInstanceData( hPrevInstance, (PSTR)szAppName, 10 );
  161.     GetInstanceData( hPrevInstance, (PSTR)szAbout, 10 );
  162.     GetInstanceData( hPrevInstance, (PSTR)szMessage, 40 );
  163.     GetInstanceData( hPrevInstance, (PSTR)&MessageLength, sizeof(int) );
  164.     }
  165.  
  166.     // load the plyvfw.dll file and check if it exists before we decide to continue with the program.  
  167.     // This file contains all the calls into mmsystem.dll.
  168.  
  169.     hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  170.  
  171.     if (hLibrary < 32)
  172.      {
  173.      MessageBox(NULL,"The plyvfw.dll file is missing please copy this file and try again","ERROR",MB_OK);
  174.      return FALSE;
  175.     }
  176.     else
  177.     
  178.     FreeLibrary(hLibrary);
  179.                                                           
  180.     // Allocate memory for each of the different devices (owner draw buttons).  This program contains up 
  181.     // to 8 different devices which can be active at any given time.  A device structure describes the
  182.     // different attributes of an owner draw button.  For example the device ID of the AVI file displayed
  183.     // in the owner draw button is stored in the hDevice structure.
  184.     
  185.                                                           
  186.     hDevice1=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  187.     hDevice2=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  188.     hDevice3=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  189.     hDevice4=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  190.     hDevice5=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  191.     hDevice6=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  192.     hDevice7=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  193.     hDevice8=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
  194.     hDevice9=GlobalAlloc(GHND,sizeof(DEVICESTRUCT)); 
  195.                              
  196.     // make sure all of the memory was allocated.  If not drop out of the program.                          
  197.                               
  198.     if (!hDevice1 && !hDevice2 && !hDevice3 && !hDevice4 && !hDevice5 && !hDevice6 && !hDevice7 && !hDevice8 && !hDevice9)
  199.     {
  200.      MessageBox(NULL,"The Initial memory allocation failed aborting program","ERROR",MB_OK);
  201.      return FALSE;
  202.     }
  203.                                                                                   
  204.     // lock all the memory once so it can be used in the rest of the program.                                                                              
  205.  
  206.     lpDevice1=(LPDEVICESTRUCT)GlobalLock(hDevice1);
  207.     lpDevice2=(LPDEVICESTRUCT)GlobalLock(hDevice2);
  208.     lpDevice3=(LPDEVICESTRUCT)GlobalLock(hDevice3);
  209.     lpDevice4=(LPDEVICESTRUCT)GlobalLock(hDevice4);
  210.     lpDevice5=(LPDEVICESTRUCT)GlobalLock(hDevice5);
  211.     lpDevice6=(LPDEVICESTRUCT)GlobalLock(hDevice6);
  212.     lpDevice7=(LPDEVICESTRUCT)GlobalLock(hDevice7);
  213.     lpDevice8=(LPDEVICESTRUCT)GlobalLock(hDevice8);
  214.     lpDevice9=(LPDEVICESTRUCT)GlobalLock(hDevice9);  
  215.                                                                            
  216.     // Make sure that the memory could be locked.                                                                         
  217.                                                                              
  218.     if (!lpDevice1 && !lpDevice2 && !lpDevice3 && !lpDevice4 && !lpDevice5 && !lpDevice6 && !lpDevice7 && !lpDevice8 && !lpDevice9)
  219.     {
  220.      MessageBox(NULL,"The Initial memory lock failed aborting program","ERROR",MB_OK);
  221.      return FALSE;
  222.     }
  223.                                                  
  224.                                                  
  225.     hWnd = CreateWindow((LPSTR)szAppName,
  226.             (LPSTR)szMessage,
  227.             WS_OVERLAPPED | WS_MAXIMIZE,
  228.             CW_USEDEFAULT,      /*  x - ignored for tiled windows */
  229.             CW_USEDEFAULT,      /*  y - ignored for tiled windows */
  230.             CW_USEDEFAULT,      /* cx - ignored for tiled windows */
  231.             CW_USEDEFAULT,      /* cy - ignored for tiled windows */
  232.             (HWND)NULL,        /* no parent */
  233.             (HMENU)NULL,       /* use class menu */
  234.             (HANDLE)hInstance, /* handle to window instance */
  235.             (LPSTR)NULL        /* no params to pass on */
  236.             );
  237.  
  238.     // retrieve the Video For Windows information as well as the audio information from the 
  239.     // initialization files.
  240.     
  241.     if(!InitVFWStuff(hWnd,hInstance))
  242.      return FALSE;
  243.  
  244.     hWndMain=hWnd;
  245.     bButtonDown=FALSE;
  246.  
  247.     /* Save instance handle for DialogBox */
  248.     hInst = hInstance;
  249.  
  250.  
  251.    // Load a cursor for each window.
  252.  
  253.     lpDevice1->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(TEXTCURSOR) );
  254.     lpDevice2->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(AUDIOCURSOR) );
  255.     lpDevice3->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(VIDEOCURSOR) );
  256.     lpDevice4->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(ANIMATIONCURSOR) );
  257.     lpDevice5->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(GRAPHICSCURSOR) );
  258.     lpDevice6->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(HELPCURSOR) );
  259.  
  260.     hHelloCursor=LoadCursor( NULL, IDC_ARROW );
  261.  
  262.  
  263.     /* Make window visible according to the way the app is activated */
  264.     //ShowWindow( hWnd, cmdShow );
  265.     ShowWindow( hWnd, SW_MAXIMIZE );
  266.     UpdateWindow( hWnd );
  267.  
  268.     hWndButtonBar=0;
  269.     /* Polling messages from event queue */
  270.     while (GetMessage((LPMSG)&msg, NULL, 0, 0)) 
  271.          {
  272.          if (hWndButtonBar==0 || !IsDialogMessage(hWndButtonBar,&msg))
  273.               {
  274.                TranslateMessage((LPMSG)&msg);
  275.                DispatchMessage((LPMSG)&msg);
  276.                }
  277.          }
  278.  
  279.     return (int)msg.wParam;
  280. }
  281.  
  282.  /****************************************************************************
  283.  
  284.     FUNCTION  :  PlayVFWWndProc( HWND, unsigned, WORD, LONG)
  285.  
  286.     PURPOSE   :  This is the main PlayVFWWnd procedure.  This function
  287.          calls into the DLL plysnd.
  288.  
  289.     COMMENTS  :
  290.  
  291.  
  292.     HISTORY   :
  293.  
  294. ****************************************************************************/
  295.  
  296. /* Procedures which make up the window class. */
  297. long FAR PASCAL PlayVFWWndProc( hWnd, message, wParam, lParam )
  298. HWND hWnd;
  299. unsigned message;
  300. WORD wParam;
  301. LONG lParam;
  302. {
  303.     //PAINTSTRUCT ps;
  304.     //HMENU hMyMenu;
  305.  
  306.     FARPROC lpfnPlayVFWFile;
  307.     FARPROC lpfnUpdateVFW;
  308.     FARPROC lpfnPlayVFWFileWait;
  309.     FARPROC lpfnCloseVFWFile;
  310.     FARPROC lpfnCloseVFWDevice;
  311.     FARPROC lpfnSeekVFWToStart;
  312.     FARPROC lpfnCloseWaveDevice;
  313.     FARPROC lpfnPlayWaveFile;
  314.     FARPROC lpfnCloseWaveFile;
  315.  
  316.     BOOL bReturn;
  317.     WORD wCurrentDevice;
  318.  
  319.     UINT uixPos;
  320.     UINT uiyPos;
  321.     RECT ChildWinRect;
  322.     HDC hTempDC;
  323.  
  324.     switch (message)
  325.     {
  326.     case WM_CREATE:
  327.  
  328.     break;
  329.  
  330.     case WM_SYSCOMMAND:
  331.     switch (wParam)
  332.     {
  333.  
  334.     case IDSABOUT:
  335.         /* Bind callback function with module instance */
  336.         lpprocAbout = MakeProcInstance( (FARPROC)About, hInst);
  337.  
  338.         DialogBox( hInst, MAKEINTRESOURCE(ABOUTBOX), hWnd, lpprocAbout );
  339.         FreeProcInstance(lpprocAbout);
  340.         break;
  341.  
  342.     default:
  343.         return DefWindowProc( hWnd, message, wParam, lParam );
  344.  
  345.     }
  346.     break;
  347.  
  348.     case WM_COMMAND:
  349.      break;
  350.  
  351.     case WM_USER+1:
  352.      MessageBox(hWndMain,"I'm closing now","Goodbye",MB_OK);
  353.  
  354.      PostMessage(hWndMain,WM_CLOSE,0,0L);
  355.     break;
  356.      
  357.      
  358.     // This message is sent to the parent window of an Owner Draw button when some action is taken in 
  359.     // that owner draw button.  The action I am looking for is a Left Button Down message.  Since the 
  360.     // Owner draw button has its own window procedure the WM_LBUTTONDOWN message will not be directly 
  361.     // sent to the parents window procedure.  Inderectly windows sends a WM_PARENTNOTIFY message. 
  362.      
  363.     case WM_PARENTNOTIFY:
  364.  
  365.     // When we recieve a WM_PARENTNOTIFY message the action that was taken is represented in the wParam.
  366.     // We are looking for a Left Button click, for simplicity all we care about is that the button was
  367.     // pressed.
  368.                               
  369.      if (wParam==WM_LBUTTONDOWN)
  370.           {    
  371.            // Grab the X and Y position of the Mouse cursor which is stored in the high and low word of
  372.            // the lParam.  This postion will help determine which button the cursor was over when the
  373.            // mouse button was depressed.
  374.           
  375.            uixPos=LOWORD(lParam);
  376.            uiyPos=HIWORD(lParam);
  377.                                          
  378.            // The Function GetRealClientRect is used to retrieve the x,y,dx,dy position of the button.  
  379.            // The coordinates retrieved is relative to the top left corner of the client area and not
  380.            // the screen.  Therefore these coordinates are relative to what is being returned in the 
  381.            // Low and High word of lParam.
  382.                                          
  383.            GetRealClientRect(lpDevice1->hWnd,hWnd,&ChildWinRect);
  384.            
  385.            // check to see if the button was depressed while the cursor was over the owner draw button.
  386.            
  387.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  388.             {
  389.             
  390.             // if the button was depressed while the cursor was over the owner draw button and this
  391.             // is page 2 do the stuff appropriate to page 2.
  392.             
  393.             if (bIsPage2)
  394.                  {
  395.              //PostMessage(hWndMain,WM_USER+1,0,0L);
  396.                    
  397.                   MessageBox(hWndMain,"Window 1","Here We go",MB_OK);
  398.                  // if (bButtonDown) 
  399.                    //    bButtonDown=FALSE;
  400.                  // else
  401.                   //PostMessage(hWndMain,WM_CLOSE,0,0L); 
  402.                   ShowWindow( lpDevice9->hWnd, SW_HIDE ); 
  403.                   ShowWindow(hWndEdit, SW_SHOWNORMAL );    
  404.                   return FALSE;
  405.                   }
  406.  
  407.             if(bIsPage1)
  408.              {
  409.              
  410.              // if this is page 1 set that a button was clicked and that there is no video playing.
  411.              
  412.               lpDevice1->bRButtonClicked=TRUE;
  413.               lpDevice1->bVideoPlaying=FALSE;
  414.  
  415.               SeekAllToStart();
  416.  
  417.               ShowWindow( lpDevice1->hWnd, SW_HIDE );
  418.  
  419.               //ChildWinRect.left=ChildWinRect.left-50;
  420.               //ChildWinRect.top=ChildWinRect.top-50;
  421.               //ChildWinRect.bottom=ChildWinRect.bottom+50;
  422.              // ChildWinRect.right=ChildWinRect.right+50;
  423.  
  424.               //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  425.               //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  426.  
  427.               //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  428.               //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  429.  
  430.               hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  431.  
  432.               if (hLibrary >= 32)
  433.                   {   
  434.                    
  435.                    Morph(lpDevice8,1,hLibrary);
  436.  
  437.                    lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  438.                    lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  439.  
  440.                    hTempDC=GetDC(lpDevice8->hWnd);
  441.  
  442.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  443.  
  444.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  445.  
  446.                    (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  447.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  448.  
  449.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  450.  
  451.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  452.  
  453.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  454.  
  455.  
  456.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  457.  
  458.  
  459.                    DoNextPage(hLibrary,1);
  460.  
  461.                    FreeLibrary(hLibrary);
  462.                   }
  463.  
  464.               //bIsPage1=FALSE;
  465.              // bIsPage2=TRUE;
  466.  
  467.               //DrawRectOutsideButton(hWnd,ChildWinRect);
  468.              } // if bIsPage1
  469.             return FALSE;
  470.             }
  471.  
  472.            GetRealClientRect(lpDevice2->hWnd,hWnd,&ChildWinRect);
  473.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  474.             {
  475.             if (bIsPage2)
  476.                   {      
  477.                    
  478.              //PostMessage(hWndMain,WM_USER+1,0,0L);
  479.              //PostMessage(hWndMain,WM_CLOSE,0,0L);
  480.                    //MessageBox(hWndMain,"Window 2","Here We go",MB_OK);
  481.                   // if (bButtonDown)
  482.                   //       bButtonDown=FALSE;
  483.                   // else
  484.                   //      PostMessage(hWndMain,WM_CLOSE,0,0L); 
  485.                   ShowWindow( lpDevice9->hWnd, SW_HIDE ); 
  486.                   ShowWindow(hWndEdit, SW_SHOWNORMAL );
  487.  
  488.                   return FALSE;    
  489.              //FreeDevices(hWndMain);
  490.                    }
  491.  
  492.             if(bIsPage1)
  493.              {
  494.                lpDevice2->bVideoPlaying=FALSE;
  495.                 lpDevice2->bRButtonClicked=TRUE;
  496.                 SeekAllToStart();
  497.  
  498.                 ShowWindow( lpDevice2->hWnd, SW_HIDE );
  499.  
  500.                 //ChildWinRect.left=ChildWinRect.left-50;
  501.                 //ChildWinRect.top=ChildWinRect.top-50;
  502.                // ChildWinRect.bottom=ChildWinRect.bottom+50;
  503.                // ChildWinRect.right=ChildWinRect.right+50;
  504.  
  505.                 //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  506.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  507.                 //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  508.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  509.  
  510.                 hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  511.  
  512.                 if (hLibrary >= 32)
  513.                 {
  514.  
  515.                  lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  516.                    lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  517.  
  518.                    Morph(lpDevice8,2,hLibrary);
  519.  
  520.                    hTempDC=GetDC(lpDevice8->hWnd);
  521.  
  522.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  523.  
  524.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  525.                    (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  526.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  527.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  528.  
  529.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  530.  
  531.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  532.  
  533.  
  534.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  535.  
  536.  
  537.  
  538.                    DoNextPage(hLibrary,2);
  539.                    FreeLibrary(hLibrary);
  540.                  }
  541.  
  542.                // bIsPage1=FALSE;
  543.                 //bIsPage2=TRUE;
  544.  
  545.                 //DrawRectOutsideButton(hWnd,ChildWinRect);
  546.              } //bPageIs1
  547.  
  548.              return FALSE;
  549.             }
  550.  
  551.            GetRealClientRect(lpDevice3->hWnd,hWnd,&ChildWinRect);
  552.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  553.             {
  554.             if (bIsPage2)
  555.                   {  
  556.                    //SeekAllToStart();
  557.                   // MessageBox(hWndMain,"Window 3","Here We go",MB_OK);
  558.                    //if (bButtonDown)
  559.                    //     bButtonDown=FALSE;
  560.                   // else
  561.                     //PostMessage(hWndMain,WM_CLOSE,0,0L);
  562.  
  563.                   ShowWindow( hWndEdit, SW_HIDE ); 
  564.                   ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
  565.  
  566.                   if(lstrlen(lpDevice3->szFileName))
  567.  
  568.  
  569.  
  570.              //PostMessage(hWndMain,WM_USER+1,0,0L);  
  571.                    return FALSE;
  572.                    }
  573.  
  574.             if(bIsPage1)
  575.              {
  576.                 lpDevice3->bRButtonClicked=TRUE;
  577.               lpDevice3->bVideoPlaying=FALSE;
  578.                 SeekAllToStart();
  579.                 ShowWindow( lpDevice3->hWnd, SW_HIDE );
  580.  
  581.                 //ChildWinRect.left=ChildWinRect.left-50;
  582.                // ChildWinRect.top=ChildWinRect.top-50;
  583.                // ChildWinRect.bottom=ChildWinRect.bottom+50;
  584.                // ChildWinRect.right=ChildWinRect.right+50;
  585.  
  586.                 //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  587.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  588.                // SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  589.                // ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  590.  
  591.                 hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  592.  
  593.                 if (hLibrary >= 32)
  594.                 {
  595.                  lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  596.                    lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  597.                    Morph(lpDevice8,3,hLibrary);
  598.  
  599.                    hTempDC=GetDC(lpDevice8->hWnd);
  600.  
  601.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  602.  
  603.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  604.                  (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  605.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  606.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  607.  
  608.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  609.  
  610.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  611.  
  612.  
  613.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  614.  
  615.  
  616.                    DoNextPage(hLibrary,3);
  617.                  FreeLibrary(hLibrary);
  618.                  }
  619.  
  620.                 // bIsPage1=FALSE;
  621.                //  bIsPage2=TRUE;
  622.  
  623.                 //DrawRectOutsideButton(hWnd,ChildWinRect);
  624.              } 
  625.              return FALSE;
  626.             }
  627.  
  628.            GetRealClientRect(lpDevice4->hWnd,hWnd,&ChildWinRect);
  629.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  630.             {
  631.             if (bIsPage2)
  632.              {
  633.               ShowWindow( hWndEdit, SW_HIDE );
  634.               ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
  635.  
  636.              if (lstrlen(lpDevice4->szFileName))
  637.                   WinExec(lpDevice4->szFileName,SW_SHOW);
  638.  
  639.              return FALSE;
  640.  
  641.              }
  642.  
  643.              if(bIsPage1)
  644.              {
  645.                 lpDevice4->bRButtonClicked=TRUE;
  646.                 lpDevice4->bVideoPlaying=FALSE;
  647.  
  648.                 SeekAllToStart();
  649.                 ShowWindow( lpDevice4->hWnd, SW_HIDE );
  650.  
  651.                 //ChildWinRect.left=ChildWinRect.left-50;
  652.                 //ChildWinRect.top=ChildWinRect.top-50;
  653.                // ChildWinRect.bottom=ChildWinRect.bottom+50;
  654.                 //ChildWinRect.right=ChildWinRect.right+50;
  655.  
  656.                 //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  657.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  658.                 //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  659.                // ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  660.  
  661.                 hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  662.  
  663.                 if (hLibrary >= 32)
  664.                 {
  665.                  lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  666.                    lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  667.                   Morph(lpDevice8,4,hLibrary);
  668.  
  669.                    hTempDC=GetDC(lpDevice8->hWnd);
  670.  
  671.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  672.  
  673.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  674.                  (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  675.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  676.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  677.  
  678.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  679.  
  680.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  681.  
  682.  
  683.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  684.  
  685.  
  686.                    DoNextPage(hLibrary,4);
  687.                  FreeLibrary(hLibrary);
  688.                  }
  689.  
  690.                  //bIsPage1=FALSE;
  691.                  //bIsPage2=TRUE;
  692.  
  693.             //DrawRectOutsideButton(hWnd,ChildWinRect);
  694.               }        
  695.               return FALSE;
  696.             }
  697.  
  698.            GetRealClientRect(lpDevice5->hWnd,hWnd,&ChildWinRect);
  699.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  700.             {
  701.             if (bIsPage2)
  702.              {
  703.             MessageBox(hWndMain,"Window 5","Here We go",MB_OK);
  704.             if (bButtonDown)
  705.                  bButtonDown=FALSE;
  706.             else
  707.                  PostMessage(hWndMain,WM_CLOSE,0,0L);
  708.              //PostMessage(hWndMain,WM_USER+1,0,0L);
  709.              }
  710.  
  711.             if(bIsPage1)
  712.              {
  713.                 lpDevice5->bRButtonClicked=TRUE;
  714.                 lpDevice5->bVideoPlaying=FALSE;
  715.                 SeekAllToStart();
  716.                 ShowWindow( lpDevice5->hWnd, SW_HIDE );
  717.  
  718.                 //ChildWinRect.left=ChildWinRect.left-50;
  719.                 //ChildWinRect.top=ChildWinRect.top-50;
  720.                 //ChildWinRect.bottom=ChildWinRect.bottom+50;
  721.                 //ChildWinRect.right=ChildWinRect.right+50;
  722.  
  723.                 //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  724.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  725.  
  726.                 //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  727.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  728.  
  729.                 hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  730.  
  731.                 if (hLibrary >= 32)
  732.                 {
  733.                  lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  734.                   lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  735.                   Morph(lpDevice8,5,hLibrary);
  736.                   //lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  737.                    hTempDC=GetDC(lpDevice8->hWnd);
  738.  
  739.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  740.  
  741.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  742.                   (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  743.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  744.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  745.  
  746.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  747.  
  748.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  749.  
  750.  
  751.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  752.  
  753.  
  754.                    DoNextPage(hLibrary,5);
  755.                  FreeLibrary(hLibrary);
  756.                 }
  757.  
  758.                  //bIsPage1=FALSE;
  759.                  //bIsPage2=TRUE;
  760.  
  761.             //DrawRectOutsideButton(hWnd,ChildWinRect);
  762.              }  
  763.              return FALSE;
  764.             }
  765.  
  766.  
  767.            GetRealClientRect(lpDevice6->hWnd,hWnd,&ChildWinRect);
  768.            if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
  769.             {
  770.             if (bIsPage2)
  771.              {
  772.             MessageBox(hWndMain,"Window 6","Here We go",MB_OK);
  773.             if (bButtonDown)
  774.                  bButtonDown=FALSE;
  775.             else
  776.                  PostMessage(hWndMain,WM_CLOSE,0,0L);
  777.              //PostMessage(hWndMain,WM_USER+1,0,0L);
  778.              }
  779.  
  780.             if(bIsPage1)
  781.              {
  782.                 lpDevice6->bRButtonClicked=TRUE;
  783.               lpDevice6->bVideoPlaying=FALSE;
  784.                 SeekAllToStart();
  785.                 ShowWindow( lpDevice6->hWnd, SW_HIDE );
  786.  
  787.                 //ChildWinRect.left=ChildWinRect.left-50;
  788.                 //ChildWinRect.top=ChildWinRect.top-50;
  789.                // ChildWinRect.bottom=ChildWinRect.bottom+50;
  790.                // ChildWinRect.right=ChildWinRect.right+50;
  791.  
  792.                 //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
  793.                 //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  794.  
  795.                // SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
  796.               //  ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
  797.  
  798.                 hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  799.  
  800.                 if (hLibrary >= 32)
  801.                 {
  802.                  lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
  803.                    lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  804.  
  805.                    Morph(lpDevice8,6,hLibrary);
  806.                    hTempDC=GetDC(lpDevice8->hWnd);
  807.  
  808.                    (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
  809.  
  810.                    ReleaseDC(lpDevice8->hWnd,hTempDC);
  811.  
  812.                    (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
  813.  
  814.                    ShowWindow( lpDevice8->hWnd, SW_HIDE );
  815.  
  816.                    lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  817.  
  818.                    bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
  819.  
  820.                    lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  821.  
  822.  
  823.                    bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
  824.  
  825.  
  826.                    DoNextPage(hLibrary,6);
  827.                  FreeLibrary(hLibrary);
  828.                  }
  829.  
  830.                 //bIsPage1=FALSE;
  831.                 //bIsPage2=TRUE;
  832.  
  833.             //DrawRectOutsideButton(hWnd,ChildWinRect);
  834.               }     
  835.               return FALSE;
  836.             }
  837.  
  838.           } // end of if wParam == WM_RBUTTONDOWN 
  839.           
  840.     if (wParam==WM_RBUTTONDOWN)
  841.          {
  842.          if (bIsPage2) 
  843.               PostMessage(hWndMain,WM_CLOSE,0,0L); 
  844.                    
  845.          if (bIsPage0)
  846.               DoPage1();
  847.           }  
  848.                                           
  849.          return FALSE;
  850.     break;       
  851.           
  852.     return FALSE;
  853.     break;
  854.  
  855.     case MM_MCINOTIFY:
  856.  
  857.     /* This is where we check the status of an AVI  */
  858.     /* movie that might have been playing.  We do   */
  859.     /* the play with MCI_NOTIFY on so we should get */
  860.     /* a MCI_NOTIFY_SUCCESSFUL if the play        */
  861.     /* completes on it's own.                       */
  862.  
  863.      switch(wParam)
  864.           {
  865.           case MCI_NOTIFY_SUCCESSFUL:
  866.            {
  867.  
  868.     /* the play finished, let's rewind */
  869.     /* and clear our flag.           */
  870.  
  871.            //fPlaying = FALSE;
  872.            hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  873.  
  874.            if (hLibrary >= 32)
  875.             {
  876.  
  877.              lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
  878.              lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  879.  
  880.              wCurrentDevice=LOWORD(lParam);
  881.  
  882.              (*lpfnSeekVFWToStart) (wCurrentDevice);
  883.  
  884.              //if ((wCurrentDevice==lpDevice1->wDeviceID) && lpDevice1->bPlayVideo)
  885.                //     (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,wCurrentDevice);
  886.  
  887.              if ((wCurrentDevice==lpDevice1->wDeviceID) && lpDevice1->bVideoPlaying)
  888.                    (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,wCurrentDevice);
  889.  
  890.              if ((wCurrentDevice==lpDevice2->wDeviceID) && lpDevice2->bVideoPlaying)
  891.                   (*lpfnPlayVFWFile) (hWnd,lpDevice2->hWnd,wCurrentDevice);
  892.  
  893.              if ((wCurrentDevice==lpDevice3->wDeviceID) && lpDevice3->bVideoPlaying)
  894.                   (*lpfnPlayVFWFile) (hWnd,lpDevice3->hWnd,wCurrentDevice);
  895.  
  896.              if ((wCurrentDevice==lpDevice4->wDeviceID) && lpDevice4->bVideoPlaying)
  897.                   (*lpfnPlayVFWFile) (hWnd,lpDevice4->hWnd,wCurrentDevice);
  898.  
  899.              if ((wCurrentDevice==lpDevice5->wDeviceID) && lpDevice5->bVideoPlaying)
  900.                   (*lpfnPlayVFWFile) (hWnd,lpDevice5->hWnd,wCurrentDevice);
  901.  
  902.              if ((wCurrentDevice==lpDevice6->wDeviceID) && lpDevice6->bVideoPlaying)
  903.                   (*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,wCurrentDevice);
  904.  
  905.              if ((wCurrentDevice==lpDevice7->wDeviceID) && lpDevice7->bVideoPlaying && bIsPage0)
  906.                  {   
  907.                   DoPage1();
  908.                   
  909.  
  910.                   //(*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,wCurrentDevice);
  911.                  }
  912.  
  913.  
  914.              FreeLibrary(hLibrary);
  915.             }
  916.  
  917.            //mciSendCommand(wGlobalDeviceID, MCI_SEEK, MCI_SEEK_TO_START, (DWORD)(LPVOID)NULL);
  918.            return FALSE;
  919.            }
  920.         }
  921.     break;
  922.  
  923.     case WM_DRAWITEM:
  924.       DrawControl(hWnd, (LPDRAWITEMSTRUCT)lParam);
  925.     break;
  926.  
  927.     
  928.     
  929.     case WM_CLOSE:
  930.     FreeDevices(hWndMain);
  931.     DestroyWindow(hWndButtonBar);
  932.     
  933.     DestroyWindow(lpDevice1->hWnd);
  934.     DestroyWindow(lpDevice2->hWnd);
  935.     DestroyWindow(lpDevice3->hWnd);
  936.     DestroyWindow(lpDevice4->hWnd);
  937.     DestroyWindow(lpDevice5->hWnd);
  938.     DestroyWindow(lpDevice6->hWnd);
  939.     DestroyWindow(lpDevice7->hWnd);
  940.     DestroyWindow(lpDevice8->hWnd);
  941.     DestroyWindow(lpDevice9->hWnd);  
  942.     
  943.     SetCursor(hHelloCursor);
  944.  
  945.     DestroyCursor(lpDevice1->hCursor);
  946.     DestroyCursor(lpDevice2->hCursor);
  947.     DestroyCursor(lpDevice3->hCursor);
  948.     DestroyCursor(lpDevice4->hCursor);
  949.     DestroyCursor(lpDevice5->hCursor);
  950.     DestroyCursor(lpDevice6->hCursor);
  951.     //DestroyCursor(lpDevice7->hCursor);
  952.     //DestroyCursor(lpDevice8->hCursor);
  953.  
  954.     GlobalUnlock(hDevice1);
  955.     GlobalFree(hDevice1);
  956.  
  957.     GlobalUnlock(hDevice2);
  958.     GlobalFree(hDevice2);
  959.  
  960.     GlobalUnlock(hDevice3);
  961.     GlobalFree(hDevice3);
  962.  
  963.     GlobalUnlock(hDevice4);
  964.     GlobalFree(hDevice4);
  965.  
  966.     GlobalUnlock(hDevice5);
  967.     GlobalFree(hDevice5);
  968.  
  969.     GlobalUnlock(hDevice6);
  970.     GlobalFree(hDevice6);
  971.  
  972.     GlobalUnlock(hDevice7);
  973.     GlobalFree(hDevice7);
  974.  
  975.     GlobalUnlock(hDevice8);
  976.     GlobalFree(hDevice8);  
  977.     
  978.     GlobalUnlock(hDevice9);
  979.     GlobalFree(hDevice9); 
  980.     
  981.     DestroyWindow(hWnd);
  982.  
  983.     return FALSE;
  984.     break;
  985.  
  986.     case WM_SETCURSOR:
  987.  
  988.       if(wParam==lpDevice1->hWnd)
  989.            {
  990.         if(bIsPage1)
  991.               SetCursor(lpDevice1->hCursor);
  992.  
  993.         if(!lpDevice1->bVideoPlaying)
  994.               {
  995.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  996.                if (hLibrary >= 32)
  997.                  {
  998.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  999.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1000.  
  1001.                   SeekAllToStart();
  1002.  
  1003.                   //if (lstrlen(lpDevice1->szAudioFile))
  1004.                   //     (*lpfnSndPlaySnd) (lpDevice1->hWnd,lpDevice1->szAudioFile);
  1005.  
  1006.  
  1007.  
  1008.                   (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,lpDevice1->wDeviceID);
  1009.                   (*lpfnPlayWaveFile) (lpDevice1->wAudioDeviceID);
  1010.  
  1011.                   lpDevice1->bVideoPlaying=TRUE;
  1012.                   FreeLibrary(hLibrary);
  1013.                   }
  1014.  
  1015.             break;
  1016.             }
  1017.  
  1018.         return TRUE;
  1019.         }
  1020.  
  1021.       if(wParam==lpDevice2->hWnd)
  1022.            {   
  1023.                      
  1024.         if(bIsPage1)   
  1025.              SetCursor(lpDevice2->hCursor); 
  1026.              
  1027.         if(!lpDevice2->bVideoPlaying)
  1028.               {
  1029.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1030.                if (hLibrary >= 32)
  1031.                  {
  1032.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1033.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1034.  
  1035.                   SeekAllToStart();
  1036.                   //if (lstrlen(lpDevice2->szAudioFile))
  1037.                   //     (*lpfnSndPlaySnd) (lpDevice2->hWnd,lpDevice2->szAudioFile);
  1038.  
  1039.  
  1040.                   (*lpfnPlayVFWFile) (hWnd,lpDevice2->hWnd,lpDevice2->wDeviceID);
  1041.                   (*lpfnPlayWaveFile) (lpDevice2->wAudioDeviceID);
  1042.  
  1043.                   lpDevice2->bVideoPlaying=TRUE;
  1044.                   FreeLibrary(hLibrary);
  1045.                  }
  1046.               break;
  1047.               }
  1048.  
  1049.         return TRUE;
  1050.         }
  1051.  
  1052.       if(wParam==lpDevice3->hWnd)
  1053.            {
  1054.         if(bIsPage1)
  1055.               SetCursor(lpDevice3->hCursor);
  1056.  
  1057.         if(!lpDevice3->bVideoPlaying)
  1058.               {
  1059.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1060.                if (hLibrary >= 32)
  1061.                  {
  1062.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1063.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1064.  
  1065.                   SeekAllToStart();
  1066.  
  1067.                   //if (lstrlen(lpDevice3->szAudioFile))
  1068.                   //     (*lpfnSndPlaySnd) (lpDevice3->hWnd,lpDevice3->szAudioFile);
  1069.  
  1070.  
  1071.                   (*lpfnPlayVFWFile) (hWnd,lpDevice3->hWnd,lpDevice3->wDeviceID);
  1072.                   (*lpfnPlayWaveFile) (lpDevice3->wAudioDeviceID);
  1073.  
  1074.                   lpDevice3->bVideoPlaying=TRUE;
  1075.                   FreeLibrary(hLibrary);
  1076.                  }
  1077.               break;
  1078.               }
  1079.  
  1080.         return TRUE;
  1081.         }
  1082.  
  1083.       if(wParam==lpDevice4->hWnd)
  1084.            {
  1085.         if(bIsPage1)
  1086.              SetCursor(lpDevice4->hCursor);
  1087.  
  1088.         if(!lpDevice4->bVideoPlaying)
  1089.               {
  1090.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1091.                if (hLibrary >= 32)
  1092.                  {
  1093.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1094.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1095.  
  1096.                   SeekAllToStart();
  1097.  
  1098.                   //if (lstrlen(lpDevice4->szAudioFile))
  1099.                   //     (*lpfnSndPlaySnd) (lpDevice4->hWnd,lpDevice4->szAudioFile);
  1100.  
  1101.  
  1102.                   (*lpfnPlayVFWFile) (hWnd,lpDevice4->hWnd,lpDevice4->wDeviceID);
  1103.                   (*lpfnPlayWaveFile) (lpDevice4->wAudioDeviceID);
  1104.  
  1105.                   lpDevice4->bVideoPlaying=TRUE;
  1106.                   FreeLibrary(hLibrary);
  1107.                  }
  1108.               break;
  1109.               }
  1110.  
  1111.  
  1112.         return TRUE;
  1113.         }
  1114.  
  1115.       if(wParam==lpDevice5->hWnd)
  1116.            {
  1117.         if(bIsPage1)
  1118.              SetCursor(lpDevice5->hCursor);
  1119.  
  1120.         if(!lpDevice5->bVideoPlaying)
  1121.               {
  1122.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1123.                if (hLibrary >= 32)
  1124.                  {
  1125.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1126.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1127.  
  1128.                   SeekAllToStart();
  1129.  
  1130.                   //if (lstrlen(lpDevice5->szAudioFile))
  1131.                   //     (*lpfnSndPlaySnd) (lpDevice5->hWnd,lpDevice5->szAudioFile);
  1132.  
  1133.                   (*lpfnPlayVFWFile) (hWnd,lpDevice5->hWnd,lpDevice5->wDeviceID);
  1134.                   (*lpfnPlayWaveFile) (lpDevice5->wAudioDeviceID);
  1135.  
  1136.                   lpDevice5->bVideoPlaying=TRUE;
  1137.                   FreeLibrary(hLibrary);
  1138.                   }
  1139.               break;
  1140.               }
  1141.  
  1142.  
  1143.         return TRUE;
  1144.         }
  1145.  
  1146.       if(wParam==lpDevice6->hWnd)
  1147.            {
  1148.         if(bIsPage1)
  1149.               SetCursor(lpDevice6->hCursor);
  1150.  
  1151.         if(!lpDevice6->bVideoPlaying)
  1152.               {
  1153.                hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1154.                if (hLibrary >= 32)
  1155.                  {
  1156.                   lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1157.                   lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
  1158.  
  1159.                   SeekAllToStart();
  1160.  
  1161.                   (*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,lpDevice6->wDeviceID);
  1162.                   (*lpfnPlayWaveFile) (lpDevice6->wAudioDeviceID);
  1163.  
  1164.                   lpDevice6->bVideoPlaying=TRUE;
  1165.                   FreeLibrary(hLibrary);
  1166.                   }
  1167.               break;
  1168.               }
  1169.  
  1170.  
  1171.         return TRUE;
  1172.         }
  1173.  
  1174.       if(wParam==hWnd)
  1175.            {
  1176.         SeekAllToStart();
  1177.         SetCursor(hHelloCursor);
  1178.         return TRUE;
  1179.         }
  1180.  
  1181.     return FALSE;
  1182.  
  1183.  
  1184.     case WM_DESTROY:
  1185.  
  1186.     PostQuitMessage( 0 );
  1187.     break;
  1188.  
  1189. //    case WM_PAINT:
  1190.  
  1191.  
  1192. //      BeginPaint( hWnd, (LPPAINTSTRUCT)&ps );
  1193. //      PlayVFWPaint( ps.hdc );
  1194. //      EndPaint( hWnd, (LPPAINTSTRUCT)&ps );
  1195. //      break;
  1196.  
  1197.     default:
  1198.     return DefWindowProc( hWnd, message, wParam, lParam );
  1199.     break;
  1200.     }
  1201.     return(0L);
  1202. }
  1203.  
  1204.  
  1205.  
  1206.  
  1207. void DrawControl(HWND hWnd, LPDRAWITEMSTRUCT lpInfo)
  1208. {
  1209.     HBITMAP hbm, hOldbm;
  1210.     int ResourceID;
  1211.     HDC hMemDC;
  1212.     RECT ChildWinRect;
  1213.  
  1214.     FARPROC lpfnPlayVFWFile;
  1215.     FARPROC lpfnUpdateVFW;
  1216.     FARPROC lpfnPauseVFWFile;
  1217.     FARPROC lpfnResumeVFWFile;
  1218.     HANDLE hLibrary;
  1219.  
  1220.  
  1221.     hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1222.     if (hLibrary >= 32)
  1223.      {
  1224.       lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1225.       lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  1226.       lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
  1227.       lpfnPauseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(12));
  1228.  
  1229.        if (lpInfo->CtlType != ODT_BUTTON) return;
  1230.  
  1231.        // Load the bitmap for the image
  1232.  
  1233.        switch(lpInfo->CtlID)
  1234.         {
  1235.  
  1236.          case IDC_TEXT:
  1237.                if (bIsPage1 || bIsPage2)
  1238.                 {
  1239.  
  1240.                  //GetRealClientRect(lpDevice1->hWnd,hWnd,&ChildWinRect);
  1241.                  //DrawRectOutsideButton(hWnd,ChildWinRect);
  1242.  
  1243.                  textrect=lpInfo->rcItem;
  1244.  
  1245.                  if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1246.                   {
  1247.                    (*lpfnUpdateVFW) (lpDevice1->wDeviceID,lpInfo->hDC);
  1248.                    }
  1249.  
  1250.                 } // bIsPage1
  1251.  
  1252.           break;
  1253.  
  1254.          case IDC_AUDIO:
  1255.                if (bIsPage1 || bIsPage2)
  1256.                 {
  1257.                    //GetRealClientRect(lpDevice2->hWnd,hWnd,&ChildWinRect);
  1258.                   // DrawRectOutsideButton(hWnd,ChildWinRect);
  1259.  
  1260.                    audiorect=lpInfo->rcItem;
  1261.  
  1262.                    if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1263.                      {
  1264.                      (*lpfnUpdateVFW) (lpDevice2->wDeviceID,lpInfo->hDC);
  1265.                      }
  1266.                 } // bIsPage1
  1267.           break;
  1268.  
  1269.  
  1270.  
  1271.          case IDC_VIDEO:
  1272.             if (bIsPage1 || bIsPage2)
  1273.                 {
  1274.               //if (lpInfo->itemState & ODS_SELECT)
  1275.  
  1276.                    //GetRealClientRect(lpDevice3->hWnd,hWnd,&ChildWinRect);
  1277.                    //DrawRectOutsideButton(hWnd,ChildWinRect);
  1278.  
  1279.                    videorect=lpInfo->rcItem;
  1280.  
  1281.  
  1282.                    if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1283.                  {
  1284.                  (*lpfnUpdateVFW) (lpDevice3->wDeviceID,lpInfo->hDC);
  1285.                  }
  1286.  
  1287.               } // bIsPage1
  1288.          break;
  1289.  
  1290.          case IDC_ANIMATION:
  1291.              if (bIsPage1 || bIsPage2)
  1292.                 {
  1293.                  //GetRealClientRect(lpDevice4->hWnd,hWnd,&ChildWinRect);
  1294.                  //DrawRectOutsideButton(hWnd,ChildWinRect);
  1295.  
  1296.                  animationrect=lpInfo->rcItem;
  1297.  
  1298.                  if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1299.                   {
  1300.                   (*lpfnUpdateVFW) (lpDevice4->wDeviceID,lpInfo->hDC);
  1301.                   }
  1302.                 }// bIsPage1
  1303.          break;
  1304.  
  1305.  
  1306.          case IDC_GRAPHICS:
  1307.             if (bIsPage1 || bIsPage2)
  1308.                 {
  1309.                  //GetRealClientRect(lpDevice5->hWnd,hWnd,&ChildWinRect);
  1310.                  //DrawRectOutsideButton(hWnd,ChildWinRect);
  1311.  
  1312.                  graphicsrect=lpInfo->rcItem;
  1313.                  if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1314.                  {
  1315.                   (*lpfnUpdateVFW) (lpDevice5->wDeviceID,lpInfo->hDC);
  1316.  
  1317.                   }
  1318.  
  1319.                   }//bIsPage1
  1320.          break;
  1321.  
  1322.          case IDC_HELP:
  1323.             if (bIsPage1 || bIsPage2)
  1324.                 {
  1325.                 // GetRealClientRect(lpDevice6->hWnd,hWnd,&ChildWinRect);
  1326.                 // DrawRectOutsideButton(hWnd,ChildWinRect);
  1327.  
  1328.                  helprect=lpInfo->rcItem;
  1329.                  if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1330.                    {
  1331.                     (*lpfnUpdateVFW) (lpDevice6->wDeviceID,lpInfo->hDC);
  1332.                     //if (lpDevice6->bPlayVideo)
  1333.                     //      (*lpfnPlayVFWFile) (hWnd,lpInfo->hwndItem,lpDevice6->wDeviceID);
  1334.  
  1335.                      }
  1336.  
  1337.  
  1338.                 }//bIsPage1
  1339.          break;
  1340.  
  1341.          case IDC_VIDWIN:
  1342.             if (bIsPage0)
  1343.                 {
  1344.                // GetRealClientRect(lpDevice7->hWnd,hWnd,&ChildWinRect);
  1345.                // DrawRectOutsideButton(hWnd,ChildWinRect);
  1346.  
  1347.                 helprect=lpInfo->rcItem;
  1348.                 if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1349.                   {
  1350.                   (*lpfnUpdateVFW) (lpDevice7->wDeviceID,lpInfo->hDC);
  1351.                   }
  1352.  
  1353.                 if (lpInfo->itemAction == ODA_SELECT)
  1354.                   {
  1355.                    if(lpDevice7->bButtonDown)
  1356.                      lpDevice7->bButtonDown=FALSE;
  1357.                    else
  1358.                      lpDevice7->bButtonDown=TRUE;
  1359.                   } // if ODA_SELECT
  1360.                 } //bIsPage0
  1361.          break;
  1362.  
  1363.          case IDC_MORPH:
  1364.              // GetRealClientRect(lpDevice8->hWnd,hWnd,&ChildWinRect);
  1365.              // DrawRectOutsideButton(hWnd,ChildWinRect);
  1366.  
  1367.               helprect=lpInfo->rcItem;
  1368.               if (lpInfo->itemAction == ODA_DRAWENTIRE)
  1369.                 {
  1370.                  (*lpfnUpdateVFW) (lpDevice8->wDeviceID,lpInfo->hDC);
  1371.                  }
  1372.  
  1373.                if (lpInfo->itemAction == ODA_SELECT)
  1374.                 {
  1375.                 if(lpDevice8->bButtonDown)
  1376.                 lpDevice8->bButtonDown=FALSE;
  1377.                 else
  1378.                 lpDevice8->bButtonDown=TRUE;
  1379.  
  1380.  
  1381.  
  1382.                 }
  1383.  
  1384.          break;
  1385.  
  1386.  
  1387.          }
  1388.  
  1389.       FreeLibrary(hLibrary);
  1390.  
  1391.      }
  1392.  
  1393. return;
  1394. }
  1395.  
  1396.  
  1397.  
  1398.  
  1399. BOOL FAR PASCAL InitVFWStuff(hWnd,hInstance)
  1400. HWND hWnd;
  1401. HANDLE hInstance;
  1402. {
  1403.     HANDLE hLibrary;
  1404.     FARPROC lpfnOpenVFWDevice;
  1405.     FARPROC lpfnPlayVFWFile;
  1406.     FARPROC lpfnOpenWaveDevice;
  1407.  
  1408.     MCI_DGV_RECT_PARMS mciRect;
  1409.     MCI_DGV_RECT_PARMS mciRect2;
  1410.     RECT Points;
  1411.  
  1412.  
  1413.     bIsPage0=TRUE;
  1414.     bIsPage1=FALSE;
  1415.     bIsPage2=FALSE;
  1416.  
  1417.     hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  1418.  
  1419.     if (hLibrary >= 32)
  1420.      {
  1421.  
  1422.  
  1423.      lpfnOpenVFWDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(2));
  1424.      lpfnOpenWaveDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(15));
  1425.  
  1426.      wGlobalDeviceID = (*lpfnOpenVFWDevice) (hWnd);
  1427.      wGlobalAudioDeviceID = (*lpfnOpenWaveDevice) ();
  1428.  
  1429.      /* grey menu item first */
  1430.      /* enable second */
  1431.  
  1432.      if (!wGlobalDeviceID)
  1433.         {
  1434.          MessageBox(GetFocus(),"Can't open device","ERROR",MB_OK);
  1435.          FreeLibrary(hLibrary);
  1436.          return FALSE;
  1437.          }
  1438.  
  1439.      if (!wGlobalAudioDeviceID)
  1440.         {
  1441.          MessageBox(GetFocus(),"Can't open Audio device","ERROR",MB_OK);
  1442.          FreeLibrary(hLibrary);
  1443.          return FALSE;
  1444.          }
  1445.  
  1446.  
  1447.  
  1448.      InitDeviceVars(lpDevice1);
  1449.  
  1450.      if(!GetStuffFromIni(lpDevice1,1,&Points,hLibrary))
  1451.           return FALSE;
  1452.  
  1453.      lpDevice1->hWnd = CreateWindow((LPSTR)"button",
  1454.             (LPSTR)"Text window",
  1455.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1456.             Points.left,   /*  x - ignored for tiled windows */
  1457.             Points.top,    /*  y - ignored for tiled windows */
  1458.             Points.right,     /* cx - ignored for tiled windows */
  1459.             Points.bottom,      /* cy - ignored for tiled windows */
  1460.             (HWND)hWnd,       /*parent */
  1461.             (HMENU)IDC_TEXT,       /* use class menu */
  1462.             (HANDLE)hInstance, /* handle to window instance */
  1463.                         (LPSTR)NULL        /* no params to pass on */
  1464.             );
  1465.  
  1466.      InitDeviceVars(lpDevice2);
  1467.  
  1468.      GetStuffFromIni(lpDevice2,2,&Points,hLibrary);
  1469.  
  1470.      lpDevice2->hWnd = CreateWindow((LPSTR)"button",
  1471.             (LPSTR)"Audio Button",
  1472.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1473.             Points.left,    /*  x - ignored for tiled windows */
  1474.             Points.top,    /*  y - ignored for tiled windows */
  1475.             Points.right,     /* cx - ignored for tiled windows */
  1476.             Points.bottom,      /* cy - ignored for tiled windows */
  1477.             (HWND)hWnd,       /*parent */
  1478.             (HMENU)IDC_AUDIO,    /* use class menu */
  1479.             (HANDLE)hInstance, /* handle to window instance */
  1480.                         (LPSTR)NULL        /* no params to pass on */
  1481.             );
  1482.  
  1483.      InitDeviceVars(lpDevice3);
  1484.  
  1485.      GetStuffFromIni(lpDevice3,3,&Points,hLibrary);
  1486.  
  1487.      lpDevice3->hWnd = CreateWindow((LPSTR)"button",
  1488.             (LPSTR)"Video Button",
  1489.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1490.             Points.left,   /*  x - ignored for tiled windows */
  1491.             Points.top,    /*  y - ignored for tiled windows */
  1492.             Points.right,     /* cx - ignored for tiled windows */
  1493.             Points.bottom,      /* cy - ignored for tiled windows */
  1494.             (HWND)hWnd,       /*parent */
  1495.             (HMENU)IDC_VIDEO,    /* use class menu */
  1496.             (HANDLE)hInstance, /* handle to window instance */
  1497.                         (LPSTR)NULL        /* no params to pass on */
  1498.             );
  1499.  
  1500.      InitDeviceVars(lpDevice4);
  1501.  
  1502.      GetStuffFromIni(lpDevice4,4,&Points,hLibrary);
  1503.  
  1504.      lpDevice4->hWnd = CreateWindow((LPSTR)"button",
  1505.             (LPSTR)"Animation Button",
  1506.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1507.             Points.left,   /*  x - ignored for tiled windows */
  1508.             Points.top,    /*  y - ignored for tiled windows */
  1509.             Points.right,     /* cx - ignored for tiled windows */
  1510.             Points.bottom,      /* cy - ignored for tiled windows */
  1511.             (HWND)hWnd,       /*parent */
  1512.             (HMENU)IDC_ANIMATION,        /* use class menu */
  1513.             (HANDLE)hInstance, /* handle to window instance */
  1514.                         (LPSTR)NULL        /* no params to pass on */
  1515.             );
  1516.  
  1517.      InitDeviceVars(lpDevice5);
  1518.  
  1519.      GetStuffFromIni(lpDevice5,5,&Points,hLibrary);
  1520.  
  1521.      lpDevice5->hWnd = CreateWindow((LPSTR)"button",
  1522.             (LPSTR)"Graphics Button",
  1523.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1524.             Points.left,   /*  x - ignored for tiled windows */
  1525.             Points.top,    /*  y - ignored for tiled windows */
  1526.             Points.right,     /* cx - ignored for tiled windows */
  1527.             Points.bottom,      /* cy - ignored for tiled windows */
  1528.             (HWND)hWnd,       /*parent */
  1529.             (HMENU)IDC_GRAPHICS,       /* use class menu */
  1530.             (HANDLE)hInstance, /* handle to window instance */
  1531.                         (LPSTR)NULL        /* no params to pass on */
  1532.                         );
  1533.  
  1534.      InitDeviceVars(lpDevice6);
  1535.  
  1536.      GetStuffFromIni(lpDevice6,6,&Points,hLibrary);
  1537.  
  1538.      lpDevice6->hWnd = CreateWindow((LPSTR)"button",
  1539.             (LPSTR)"Help Button",
  1540.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1541.             Points.left ,    /*  x - ignored for tiled windows */
  1542.             Points.top,    /*  y - ignored for tiled windows */
  1543.             Points.right,     /* cx - ignored for tiled windows */
  1544.             Points.bottom,      /* cy - ignored for tiled windows */
  1545.             (HWND)hWnd,       /*parent */
  1546.             (HMENU)IDC_HELP,       /* use class menu */
  1547.             (HANDLE)hInstance, /* handle to window instance */
  1548.                         (LPSTR)NULL        /* no params to pass on */
  1549.             );
  1550.  
  1551.      GetStuffFromIni(lpDevice7,7,&Points,hLibrary);
  1552.  
  1553.      lpDevice7->hWnd = CreateWindow((LPSTR)"button",
  1554.             (LPSTR)"LargeButton",
  1555.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  1556.             Points.left ,    /*  x - ignored for tiled windows */
  1557.             Points.top,    /*  y - ignored for tiled windows */
  1558.             Points.right,     /* cx - ignored for tiled windows */
  1559.             Points.bottom,      /* cy - ignored for tiled windows */
  1560.             (HWND)hWnd,       /*parent */
  1561.             (HMENU)IDC_VIDWIN,     /* use class menu */
  1562.             (HANDLE)hInstance, /* handle to window instance */
  1563.                         (LPSTR)NULL        /* no params to pass on */
  1564.             );
  1565.  
  1566.  
  1567.  
  1568.  
  1569.        ShowWindow(lpDevice7->hWnd,SW_SHOWNORMAL);
  1570.  
  1571.        lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  1572.        (*lpfnPlayVFWFile) (hWnd,lpDevice7->hWnd,lpDevice7->wDeviceID);
  1573.  
  1574.        lpDevice7->bVideoPlaying=TRUE;
  1575.  
  1576.        FreeLibrary(hLibrary);
  1577.        }
  1578.  
  1579. return TRUE;
  1580.  
  1581. }
  1582.  
  1583.  
  1584. BOOL FAR PASCAL DoNextPage(hLibrary,nWhichButton)
  1585. HANDLE hLibrary;
  1586. int nWhichButton;
  1587. {
  1588.      RECT Points;
  1589.      char szIniName[9];
  1590.      MSG msg;
  1591.  
  1592.      HideAllWindows();
  1593.  
  1594.      wsprintf(szIniName,"Button%d",nWhichButton);
  1595.  
  1596.      InitDeviceVars(lpDevice1);
  1597.  
  1598.      GetPG2FromIni(lpDevice1,1,&Points,hLibrary,szIniName);
  1599.       //   MoveWindow(lpDevice1->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1600.      ShowWindow( lpDevice1->hWnd, SW_SHOWNORMAL );
  1601.      SetWindowPos(lpDevice1->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1602.  
  1603.      InitDeviceVars(lpDevice2);
  1604.  
  1605.      GetPG2FromIni(lpDevice2,2,&Points,hLibrary,szIniName);
  1606.     // MoveWindow(lpDevice2->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1607.      SetWindowPos(lpDevice2->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1608.      ShowWindow( lpDevice2->hWnd, SW_SHOWNORMAL );
  1609.  
  1610.      InitDeviceVars(lpDevice3);
  1611.  
  1612.      GetPG2FromIni(lpDevice3,3,&Points,hLibrary,szIniName);
  1613.     // MoveWindow(lpDevice3->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1614.      SetWindowPos(lpDevice3->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1615.      ShowWindow( lpDevice3->hWnd, SW_SHOWNORMAL );
  1616.  
  1617.      InitDeviceVars(lpDevice4);
  1618.  
  1619.      GetPG2FromIni(lpDevice4,4,&Points,hLibrary,szIniName);
  1620.     // MoveWindow(lpDevice4->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1621.      SetWindowPos(lpDevice4->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1622.      ShowWindow( lpDevice4->hWnd, SW_SHOWNORMAL );
  1623.       
  1624.      CreateVideoWindow(nWhichButton);
  1625.       
  1626. //     InitDeviceVars(lpDevice5);
  1627.  
  1628. //     GetPG2FromIni(lpDevice5,5,&Points,hLibrary,szIniName);
  1629.      //MoveWindow(lpDevice5->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1630. //     SetWindowPos(lpDevice5->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1631. //     ShowWindow( lpDevice5->hWnd, SW_SHOWNORMAL );
  1632.  
  1633. //     InitDeviceVars(lpDevice6);
  1634.  
  1635. //     GetPG2FromIni(lpDevice6,6,&Points,hLibrary,szIniName);
  1636.      //MoveWindow(lpDevice6->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
  1637. //     SetWindowPos(lpDevice6->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  1638. //     ShowWindow( lpDevice6->hWnd, SW_SHOWNORMAL );
  1639.  
  1640.      bIsPage2=TRUE;
  1641.      bIsPage1=FALSE;
  1642.      bButtonDown=TRUE;
  1643.  
  1644. return TRUE;
  1645. }
  1646.  
  1647. BOOL FAR PASCAL GetRealClientRect(hWndChild,hWndParent,lpWinRect)
  1648. HWND hWndChild;
  1649. HWND hWndParent;
  1650. LPRECT lpWinRect;
  1651. {
  1652.  
  1653. POINT ptUpperLeft;
  1654. POINT ptLowerRight;
  1655.  
  1656.       GetWindowRect(hWndChild,lpWinRect);
  1657.  
  1658.  
  1659.       ptUpperLeft.x=lpWinRect->left;
  1660.       ptUpperLeft.y=lpWinRect->top;
  1661.       ptLowerRight.x=lpWinRect->right;
  1662.       ptLowerRight.y=lpWinRect->bottom;
  1663.  
  1664.       ScreenToClient(hWndParent,&ptLowerRight);
  1665.       ScreenToClient(hWndParent,&ptUpperLeft);
  1666.  
  1667.       lpWinRect->left=ptUpperLeft.x;
  1668.       lpWinRect->top=ptUpperLeft.y;
  1669.       lpWinRect->right=ptLowerRight.x;
  1670.       lpWinRect->bottom=ptLowerRight.y;
  1671.  
  1672. return TRUE;
  1673.  
  1674. }
  1675.  
  1676. BOOL FAR PASCAL DrawRectOutsideButton(hWnd,WinRect)
  1677. HWND hWnd;
  1678. RECT WinRect;
  1679.  
  1680. {
  1681. HDC hWinDC;
  1682. HPEN hWinPen;
  1683. HPEN hPenOld;
  1684.  
  1685.       hWinDC=GetDC(hWnd);
  1686.  
  1687.       hWinPen=CreatePen(PS_SOLID,4,RGB(0,0,0));
  1688.       hPenOld=SelectObject(hWinDC,hWinPen);
  1689.  
  1690.       Rectangle(hWinDC,WinRect.left-2,WinRect.top-2,WinRect.right+2,WinRect.bottom+2);
  1691.  
  1692.       SelectObject(hWinDC,hPenOld);
  1693.       DeleteObject(hWinPen);
  1694.  
  1695.       ReleaseDC(hWnd,hWinDC);
  1696.  
  1697. return TRUE;
  1698. }
  1699.  
  1700. BOOL FAR PASCAL GetStuffFromIni(lpDevice,nButton,lpPoints,hLibrary)
  1701. LPDEVICESTRUCT lpDevice;
  1702. int nButton;
  1703. LPRECT lpPoints;
  1704. HANDLE hLibrary;
  1705. {
  1706.      HANDLE hBuffer;
  1707.      LPSTR lpBuffer;
  1708.  
  1709.      HANDLE hSection;
  1710.      LPSTR lpSection;
  1711.  
  1712.      HANDLE hFileName;
  1713.      LPSTR lpFileName;
  1714.  
  1715.      HANDLE hEntry;
  1716.      LPSTR lpEntry;
  1717.  
  1718.      HANDLE hAlias;
  1719.      LPSTR  lpAlias;
  1720.  
  1721.      HANDLE hExeName;
  1722.      LPSTR lpExeName;
  1723.  
  1724.      int  nSize;
  1725.      int nBytes;
  1726.      int nAviFile;
  1727.      int nAudioFile;
  1728.      FARPROC lpfnOpenVFWFile;
  1729.      FARPROC lpfnOpenWaveFile;
  1730.  
  1731.      nAviFile=1;
  1732.      nAudioFile=1;
  1733.  
  1734.      hBuffer=GlobalAlloc(GHND,80);
  1735.      hSection=GlobalAlloc(GHND,10);
  1736.      hFileName=GlobalAlloc(GHND,128);
  1737.      hEntry=GlobalAlloc(GHND,20);
  1738.      hAlias=GlobalAlloc(GHND,10);
  1739.      hExeName=GlobalAlloc(GHND,10);
  1740.  
  1741.      if (hBuffer && hSection && hFileName && hEntry)
  1742.       {
  1743.        lpBuffer=GlobalLock(hBuffer);
  1744.        lpSection=GlobalLock(hSection);
  1745.        lpFileName=GlobalLock(hFileName);
  1746.        lpEntry=GlobalLock(hEntry);
  1747.        lpAlias=GlobalLock(hAlias);
  1748.        lpExeName=GlobalLock(hExeName);
  1749.  
  1750.        if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
  1751.            {
  1752.         nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
  1753.         if(nBytes)
  1754.              {
  1755.               wsprintf(lpSection,"Button%d",nButton);
  1756.               ExtractExtension(lpFileName,lpExeName);
  1757.               lstrcat(lpFileName,lpExeName);
  1758.               lstrcat(lpFileName,".ini");
  1759.  
  1760.               wsprintf(lpEntry,"AVI File%d",nAviFile);
  1761.               nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1762.               if(!nSize)
  1763.                 {
  1764.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1765.                 return FALSE;
  1766.                 }
  1767.  
  1768.               StripSpaces(lpBuffer);
  1769.  
  1770.               wsprintf(lpAlias,"foo%d",nButton);
  1771.  
  1772.               lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
  1773.  
  1774.  
  1775.               lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
  1776.  
  1777.                if (!lpDevice->wDeviceID)
  1778.                 {
  1779.                 ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
  1780.                 return FALSE;
  1781.                 }
  1782.  
  1783.                wsprintf(lpEntry,"Audio File%d",nAudioFile);
  1784.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1785.  
  1786.                if(!nSize)
  1787.                 {
  1788.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1789.                 return FALSE;
  1790.                 }
  1791.  
  1792.                StripSpaces(lpBuffer);
  1793.                //lstrcpy(lpDevice->szAudioFile,lpBuffer);
  1794.  
  1795.                wsprintf(lpAlias,"oof%d",nButton);
  1796.  
  1797.                lpfnOpenWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(16));
  1798.  
  1799.  
  1800.                lpDevice->wAudioDeviceID = (*lpfnOpenWaveFile) (wGlobalAudioDeviceID,lpBuffer,lpAlias);
  1801.  
  1802.                if (!lpDevice->wDeviceID)
  1803.                 {
  1804.                 ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
  1805.                 return FALSE;
  1806.                 }
  1807.  
  1808.                wsprintf(lpEntry,"Position%d",nAviFile);
  1809.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1810.                if(!nSize)
  1811.                 {
  1812.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1813.                 return FALSE;
  1814.                 }
  1815.  
  1816.                StripSpaces(lpBuffer);
  1817.                ReturnCoor(lpBuffer,lpPoints);
  1818.  
  1819.                lstrcpy(lpEntry,"Animation");
  1820.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1821.  
  1822.                if(!nSize)
  1823.                 {
  1824.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1825.                 return FALSE;
  1826.                 }
  1827.  
  1828.                StripSpaces(lpBuffer);
  1829.  
  1830.                if(!lstrcmp(lpBuffer,"disabled"))
  1831.                 lpDevice->bPlayVideo=FALSE;
  1832.                else
  1833.                 lpDevice->bPlayVideo=TRUE;
  1834.  
  1835.                lstrcpy(lpEntry,"Audio");
  1836.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1837.                if(!nSize)
  1838.                 {
  1839.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1840.                 return FALSE;
  1841.                 }
  1842.  
  1843.                StripSpaces(lpBuffer);
  1844.  
  1845.                if(!lstrcmp(lpBuffer,"disabled"))
  1846.                 lpDevice->bPlayAudio=FALSE;
  1847.                else
  1848.                 lpDevice->bPlayAudio=TRUE;
  1849.              } // End if nBytes
  1850.         } // End of if the memory locks succeded.
  1851.       else
  1852.            {
  1853.            MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
  1854.            }
  1855.       } // End of if the memory allocations succeded.
  1856.      else
  1857.       MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
  1858.  
  1859.  
  1860.     GlobalUnlock(hFileName);
  1861.     GlobalUnlock(hSection);
  1862.     GlobalUnlock(hBuffer);
  1863.     GlobalUnlock(hEntry);
  1864.     GlobalUnlock(hAlias);
  1865.     GlobalUnlock(hExeName);
  1866.  
  1867.     GlobalFree(hFileName);
  1868.     GlobalFree(hSection);
  1869.     GlobalFree(hBuffer);
  1870.     GlobalFree(hEntry);
  1871.     GlobalFree(hAlias);
  1872.     GlobalFree(hExeName);
  1873.  
  1874. return TRUE;
  1875. }
  1876.  
  1877. BOOL FAR PASCAL GetPG2FromIni(lpDevice,nButton,lpPoints,hLibrary,lpIniName)
  1878. LPDEVICESTRUCT lpDevice;
  1879. int nButton;
  1880. LPRECT lpPoints;
  1881. HANDLE hLibrary;
  1882. LPSTR lpIniName;
  1883. {
  1884.      HANDLE hBuffer;
  1885.      LPSTR lpBuffer;
  1886.  
  1887.      HANDLE hSection;
  1888.      LPSTR lpSection;
  1889.  
  1890.      HANDLE hFileName;
  1891.      LPSTR lpFileName;
  1892.  
  1893.      HANDLE hEntry;
  1894.      LPSTR lpEntry;
  1895.  
  1896.      HANDLE hAlias;
  1897.      LPSTR  lpAlias;
  1898.  
  1899.      HANDLE hExeName;
  1900.      LPSTR lpExeName;
  1901.  
  1902.      int  nSize;
  1903.      int nBytes;
  1904.      int nAviFile;
  1905.      int nAudioFile;
  1906.      FARPROC lpfnOpenVFWFile;
  1907.      FARPROC lpfnOpenWaveFile;
  1908.      FARPROC lpfnCloseVFWFile;
  1909.      FARPROC lpfnCloseWaveFile;
  1910.  
  1911.      BOOL bReturn;
  1912.  
  1913.      nAviFile=1;
  1914.      nAudioFile=1;
  1915.  
  1916.      hBuffer=GlobalAlloc(GHND,80);
  1917.      hSection=GlobalAlloc(GHND,10);
  1918.      hFileName=GlobalAlloc(GHND,128);
  1919.      hEntry=GlobalAlloc(GHND,20);
  1920.      hAlias=GlobalAlloc(GHND,20);
  1921.      hExeName=GlobalAlloc(GHND,10);
  1922.  
  1923.      if (hBuffer && hSection && hFileName && hEntry)
  1924.       {
  1925.        lpBuffer=GlobalLock(hBuffer);
  1926.        lpSection=GlobalLock(hSection);
  1927.        lpFileName=GlobalLock(hFileName);
  1928.        lpEntry=GlobalLock(hEntry);
  1929.        lpAlias=GlobalLock(hAlias);
  1930.        lpExeName=GlobalLock(hExeName);
  1931.  
  1932.        if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
  1933.            {
  1934.         nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
  1935.         if(nBytes)
  1936.              {
  1937.               wsprintf(lpSection,"Button%d",nButton);
  1938.               ExtractExtension(lpFileName,lpExeName);
  1939.               lstrcat(lpFileName,lpIniName);
  1940.               // put in check for a exe file already 8 characters long.
  1941.               //lstrcat(lpFileName,"2");
  1942.               lstrcat(lpFileName,".ini");
  1943.  
  1944.               wsprintf(lpEntry,"AVI File%d",nAviFile);
  1945.               nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1946.               if(!nSize)
  1947.                 {
  1948.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1949.                 return FALSE;
  1950.                 }
  1951.  
  1952.               StripSpaces(lpBuffer);
  1953.  
  1954.               if(!lstrcmp(lpIniName,"morph"))
  1955.                wsprintf(lpAlias,"for%d",nButton);
  1956.               else
  1957.                wsprintf(lpAlias,"%s%d",lpIniName,nButton);
  1958.  
  1959.               lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
  1960.               lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  1961.  
  1962.               if(lpDevice->wDeviceID)
  1963.                {
  1964.                 lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  1965.  
  1966.                 bReturn = (*lpfnCloseVFWFile) (lpDevice->wDeviceID);
  1967.                }
  1968.  
  1969.               lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
  1970.  
  1971.                if (!lpDevice->wDeviceID)
  1972.                 {
  1973.                 ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
  1974.                 return FALSE;
  1975.                 }
  1976.  
  1977.                wsprintf(lpEntry,"Audio File%d",nAudioFile);
  1978.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  1979.  
  1980.                if(!nSize)
  1981.                 {
  1982.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  1983.                 return FALSE;
  1984.                 }
  1985.  
  1986.                StripSpaces(lpBuffer);
  1987.                //lstrcpy(lpDevice->szAudioFile,lpBuffer);
  1988.                //wsprintf(lpAlias,"oof%d",nButton);
  1989.                if(!lstrcmp(lpIniName,"morph"))
  1990.                  wsprintf(lpAlias,"%s%d",lpIniName,nButton);
  1991.                else
  1992.                  wsprintf(lpAlias,"oof%d",nButton);
  1993.  
  1994.                lpfnOpenWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(16));
  1995.  
  1996.                if(lpDevice->wAudioDeviceID)
  1997.                 {
  1998.                  lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  1999.                  bReturn = (*lpfnCloseWaveFile) (lpDevice->wAudioDeviceID);
  2000.                 }
  2001.  
  2002.                lpDevice->wAudioDeviceID = (*lpfnOpenWaveFile) (wGlobalAudioDeviceID,lpBuffer,lpAlias);
  2003.  
  2004.                if (!lpDevice->wAudioDeviceID)
  2005.                 {
  2006.                 ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
  2007.                 return FALSE;
  2008.                 }
  2009.  
  2010.                wsprintf(lpEntry,"Position%d",nAviFile);
  2011.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2012.                if(!nSize)
  2013.                 {
  2014.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2015.                 return FALSE;
  2016.                 }
  2017.  
  2018.                StripSpaces(lpBuffer);
  2019.                ReturnCoor(lpBuffer,lpPoints);
  2020.  
  2021.                lstrcpy(lpEntry,"Animation");
  2022.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2023.  
  2024.                if(!nSize)
  2025.                 {
  2026.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2027.                 return FALSE;
  2028.                 }
  2029.  
  2030.                StripSpaces(lpBuffer);
  2031.  
  2032.                if(!lstrcmp(lpBuffer,"disabled"))
  2033.                 lpDevice->bPlayVideo=FALSE;
  2034.                else
  2035.                 lpDevice->bPlayVideo=TRUE;
  2036.  
  2037.                lstrcpy(lpEntry,"Audio");
  2038.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2039.                if(!nSize)
  2040.                 {
  2041.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2042.                 return FALSE;
  2043.                 }
  2044.  
  2045.                StripSpaces(lpBuffer);
  2046.  
  2047.                if(!lstrcmp(lpBuffer,"disabled"))
  2048.                 lpDevice->bPlayAudio=FALSE;
  2049.                else
  2050.                 lpDevice->bPlayAudio=TRUE;
  2051.  
  2052.               lstrcpy(lpEntry,"FileName");
  2053.  
  2054.               nSize=GetPrivateProfileString(lpSection,lpEntry,"",(LPSTR)lpDevice->szFileName,24,lpFileName);
  2055.               if(!nSize)
  2056.                 {
  2057.                 lstrcpy(lpBuffer,lpDevice->szFileName);
  2058.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2059.                 return FALSE;
  2060.                 }
  2061.  
  2062.               StripSpaces((LPSTR)lpDevice->szFileName);
  2063.  
  2064.               //lstrcpy(lpDevice->FileName,lpBuffer);
  2065.  
  2066.              } // End if nBytes
  2067.         } // End of if the memory locks succeded.
  2068.       else
  2069.            {
  2070.            MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
  2071.            }
  2072.       } // End of if the memory allocations succeded.
  2073.      else
  2074.       MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
  2075.  
  2076.  
  2077.     GlobalUnlock(hFileName);
  2078.     GlobalUnlock(hSection);
  2079.     GlobalUnlock(hBuffer);
  2080.     GlobalUnlock(hEntry);
  2081.     GlobalUnlock(hAlias);
  2082.     GlobalUnlock(hExeName);
  2083.  
  2084.     GlobalFree(hFileName);
  2085.     GlobalFree(hSection);
  2086.     GlobalFree(hBuffer);
  2087.     GlobalFree(hEntry);
  2088.     GlobalFree(hAlias);
  2089.     GlobalFree(hExeName);
  2090.  
  2091. return TRUE;
  2092. }
  2093.  
  2094.  
  2095. // lpFileName will be of the form "c:\stuff\"
  2096.  
  2097. BOOL FAR PASCAL ExtractExtension(lpFileName,lpExeName)
  2098. LPSTR lpFileName;
  2099. LPSTR lpExeName;
  2100. {
  2101.        LPSTR lpF;
  2102.        LPSTR lpFTemp;
  2103.        LPSTR lpETemp;
  2104.        HANDLE hTempExe;
  2105.        LPSTR lpTempExe;
  2106.        LPSTR lpE2Temp;
  2107.  
  2108.        lpF=lpFileName;
  2109.  
  2110.        // set the pointer to the end of the string.
  2111.  
  2112.        while (*lpF!='\0')
  2113.       {
  2114.       lpFTemp++;
  2115.       lpF++;
  2116.       }
  2117.  
  2118.        // if the string is empty return an error;
  2119.  
  2120.        if (lpF!=lpFileName)
  2121.         lpF--;
  2122.  
  2123.        // scan back for a period in the file name, throwing out the extension.
  2124.  
  2125.        while ((*lpF!='.') && (lpF!=lpFileName) && (*lpF!='\\'))
  2126.         lpF--;
  2127.  
  2128.        // incorrect the file didn't have a path or an extension.
  2129.  
  2130.        if (lpF==lpFileName)
  2131.       {
  2132.       MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
  2133.       return FALSE;
  2134.       }
  2135.  
  2136.        // if we didn't find a period there mustn't have been an extension. Reset
  2137.        // to end of string.  Otherwise skip the period.
  2138.  
  2139.        if(*lpF=='\\')
  2140.         lpF=lpFTemp;
  2141.        else
  2142.         lpF--;
  2143.  
  2144.        // scan string until a \ is found.
  2145.  
  2146.        hTempExe=GlobalAlloc(GHND,128);
  2147.        if (hTempExe)
  2148.       {
  2149.        lpTempExe=GlobalLock(hTempExe);
  2150.        if (lpTempExe)
  2151.            {
  2152.         // set up a third party variable.
  2153.  
  2154.         lpETemp=lpTempExe;
  2155.  
  2156.         // read the string backwards into the temporary variable.
  2157.  
  2158.         while ((*lpF!='\\') && (lpF!=lpFileName))
  2159.             *lpETemp++=*lpF--;
  2160.  
  2161.         *lpETemp='\0';
  2162.         lpETemp--;
  2163.  
  2164.         // reread the string backwards and place it into the Exe name
  2165.         // variable in its correct (forward order).
  2166.  
  2167.         lpE2Temp=lpExeName;
  2168.  
  2169.         while (lpETemp!=lpTempExe)
  2170.               *lpE2Temp++=*lpETemp--;
  2171.  
  2172.         // get the last character or the first character depending on how
  2173.         // you look at it.
  2174.  
  2175.         *lpE2Temp++=*lpETemp;
  2176.  
  2177.         *lpE2Temp='\0';
  2178.         }
  2179.  
  2180.          GlobalUnlock(hTempExe);
  2181.          GlobalFree(hTempExe);
  2182.         }
  2183.        // if we are at the begining of the string and a \ was not found error.
  2184.  
  2185.  
  2186.        if (lpF==lpFileName)
  2187.       {
  2188.       MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
  2189.       return FALSE;
  2190.       }
  2191.  
  2192.        // increment one past the last backslash and add a null to terminate string.
  2193.  
  2194.        lpF++;
  2195.        *lpF='\0';
  2196.  
  2197. return TRUE;
  2198. }
  2199.  
  2200.  
  2201. BOOL FAR PASCAL StripSpaces(lpBuffer)
  2202. LPSTR lpBuffer;
  2203. {
  2204.     LPSTR lpNew;
  2205.     LPSTR lpOld;
  2206.  
  2207.     lpNew=lpBuffer;
  2208.     lpOld=lpBuffer;
  2209.  
  2210.     while (*lpNew!='\0')
  2211.       if (*lpNew==' ')
  2212.            lpNew++;
  2213.       else
  2214.            *lpOld++=*lpNew++;
  2215.  
  2216.    *lpOld='\0';
  2217.  
  2218. return TRUE;
  2219. }
  2220.  
  2221. BOOL FAR PASCAL ReturnCoor(lpBuff,lpPoints)
  2222. LPSTR lpBuff;
  2223. LPRECT lpPoints;
  2224. {
  2225.      char szNum[10];
  2226.      int  nCoor;
  2227.      LPSTR lpPB;
  2228.      LPSTR lpNum;
  2229.  
  2230.      lpPB=lpBuff;
  2231.      lpNum=szNum;
  2232.  
  2233.      while ((*lpPB!='\0') && (*lpPB!=','))
  2234.       *lpNum++=*lpPB++;
  2235.  
  2236.      if (*lpPB=='\0')
  2237.       {
  2238.       MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
  2239.       return FALSE;
  2240.      }
  2241.  
  2242.      *lpNum='\0';
  2243.  
  2244.      nCoor=atoi(szNum);
  2245.      lpPoints->left=nCoor;
  2246.  
  2247.      lpNum=szNum;
  2248.      lpPB++;
  2249.  
  2250.      while ((*lpPB!='\0') && (*lpPB!=','))
  2251.       *lpNum++=*lpPB++;
  2252.  
  2253.      if (*lpPB=='\0')
  2254.       {
  2255.       MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
  2256.       return FALSE;
  2257.      }
  2258.  
  2259.      *lpNum='\0';
  2260.  
  2261.      nCoor=atoi(szNum);
  2262.      lpPoints->top=nCoor;
  2263.  
  2264.      lpNum=szNum;
  2265.      lpPB++;
  2266.  
  2267.      while ((*lpPB!='\0') && (*lpPB!=','))
  2268.       *lpNum++=*lpPB++;
  2269.  
  2270.      if (*lpPB=='\0')
  2271.       {
  2272.       MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
  2273.       return FALSE;
  2274.      }
  2275.  
  2276.      *lpNum='\0';
  2277.  
  2278.      nCoor=atoi(szNum);
  2279.      lpPoints->right=nCoor;
  2280.  
  2281.      lpNum=szNum;
  2282.      lpPB++;
  2283.  
  2284.      while ((*lpPB!='\0') && (*lpPB!=','))
  2285.       *lpNum++=*lpPB++;
  2286.  
  2287.      if (*lpPB==',')
  2288.       {
  2289.       MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
  2290.       return FALSE;
  2291.      }
  2292.  
  2293.      *lpNum='\0';
  2294.  
  2295.      nCoor=atoi(szNum);
  2296.      lpPoints->bottom=nCoor;
  2297.  
  2298.  return TRUE;
  2299. }
  2300.  
  2301. void FAR PASCAL ReturnProfileError(LPSTR lpEntry,LPSTR lpSection,LPSTR lpFileName,HANDLE hFileName,HANDLE hSection,HANDLE hBuffer,HANDLE hExeName,HANDLE hAlias)
  2302. {
  2303.  
  2304.      HANDLE hBuf;
  2305.      LPSTR lpBuf;
  2306.  
  2307.      hBuf=GlobalAlloc(GHND,255);
  2308.      if(!hBuf)
  2309.       return;
  2310.  
  2311.      lpBuf=GlobalLock(hBuf);
  2312.  
  2313.      if (!lpBuf)
  2314.      return;
  2315.  
  2316.      wsprintf(lpBuf,"The %s entry for %s was omitted in the %s file.  Please edit the ini file.",lpEntry,lpSection,lpFileName);
  2317.      MessageBox(hWndMain,lpBuf,"ERROR",MB_OK);
  2318.  
  2319.      GlobalUnlock(hFileName);
  2320.      GlobalUnlock(hSection);
  2321.      GlobalUnlock(hBuffer);
  2322.      GlobalUnlock(hExeName);
  2323.      GlobalUnlock(hAlias);
  2324.      GlobalUnlock(hBuf);
  2325.  
  2326.      GlobalFree(hFileName);
  2327.      GlobalFree(hSection);
  2328.      GlobalFree(hBuffer);
  2329.      GlobalFree(hExeName);
  2330.      GlobalFree(hAlias);
  2331.      GlobalFree(hBuf);
  2332.  
  2333.      return;
  2334. }
  2335.  
  2336.  
  2337.  
  2338. void FAR PASCAL ReturnDeviceError(LPSTR lpBuffer,HANDLE hFileName,HANDLE hSection,HANDLE hBuffer,HANDLE hExeName,HANDLE hAlias)
  2339. {
  2340.        HANDLE hBuf;
  2341.        LPSTR lpBuf;
  2342.  
  2343.        hBuf=GlobalAlloc(GHND,255);
  2344.        if(!hBuf)
  2345.         return;
  2346.  
  2347.        lpBuf=GlobalLock(hBuf);
  2348.  
  2349.        if (!lpBuf)
  2350.            return;
  2351.  
  2352.        wsprintf(lpBuf,"The %s file could not be open.  Check that the file exists and that it is correct in the initialization file",lpBuffer);
  2353.        MessageBox(hWndMain,lpBuf,"ERROR",MB_OK);
  2354.  
  2355.        GlobalUnlock(hFileName);
  2356.        GlobalUnlock(hSection);
  2357.        GlobalUnlock(hBuffer);
  2358.        GlobalUnlock(hExeName);
  2359.        GlobalUnlock(hAlias);
  2360.        GlobalUnlock(hBuf);
  2361.  
  2362.        GlobalFree(hFileName);
  2363.        GlobalFree(hSection);
  2364.        GlobalFree(hBuffer);
  2365.        GlobalFree(hExeName);
  2366.        GlobalFree(hAlias);
  2367.        GlobalFree(hBuf);
  2368.  
  2369. return;
  2370. }
  2371.  
  2372.  
  2373. BOOL FAR PASCAL InitDeviceVars(lpDevice)
  2374. LPDEVICESTRUCT lpDevice;
  2375. {
  2376.       lpDevice->bVideoPlaying=FALSE;
  2377.       lpDevice->bAudioPlaying=FALSE;
  2378.       lpDevice->bVideoPaused=FALSE;
  2379.       lpDevice->bButtonDown=FALSE;
  2380.       lpDevice->bRButtonClicked=FALSE;
  2381.  
  2382. return TRUE;
  2383. }
  2384.  
  2385.  
  2386. BOOL FAR PASCAL Morph(lpDevice,nWhichButton,hLibrary)
  2387. LPDEVICESTRUCT lpDevice;
  2388. int nWhichButton;
  2389. HANDLE hLibrary;
  2390. {
  2391.      RECT Points;
  2392.  
  2393.  
  2394.      GetPG2FromIni(lpDevice,nWhichButton,&Points,hLibrary,"morph");
  2395.  
  2396.  
  2397.      lpDevice->hWnd = CreateWindow((LPSTR)"button",
  2398.             (LPSTR)"MorphButton",
  2399.             WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
  2400.             Points.left ,    /*  x - ignored for tiled windows */
  2401.             Points.top,    /*  y - ignored for tiled windows */
  2402.             Points.right,     /* cx - ignored for tiled windows */
  2403.             Points.bottom,      /* cy - ignored for tiled windows */
  2404.             (HWND)hWndMain,        /*parent */
  2405.             (HMENU)IDC_MORPH,    /* use class menu */
  2406.             (HANDLE)hInst, /* handle to window instance */
  2407.             (LPSTR)NULL       /* no params to pass on */
  2408.             );
  2409.  
  2410.      
  2411.  
  2412.      ShowWindow(lpDevice->hWnd, SW_SHOWNORMAL );
  2413.      SetWindowPos(lpDevice->hWnd,HWND_TOP,Points.left,Points.top,Points.bottom,Points.right,SWP_SHOWWINDOW);
  2414.      //DrawRectOutsideButton(hWndMain,ChildWinRect);
  2415.  
  2416.  
  2417.  
  2418.      return TRUE;
  2419.  
  2420. }
  2421.  
  2422. BOOL FAR PASCAL AllDone()
  2423. {
  2424.      if (lpDevice1->bRButtonClicked || lpDevice2->bRButtonClicked || lpDevice3->bRButtonClicked ||
  2425.       lpDevice4->bRButtonClicked || lpDevice5->bRButtonClicked || lpDevice6->bRButtonClicked)
  2426.       {
  2427.       if (!lpDevice1->bVideoPlaying && !lpDevice2->bVideoPlaying && !lpDevice3->bVideoPlaying
  2428.            && !lpDevice4->bVideoPlaying && !lpDevice5->bVideoPlaying && !lpDevice6->bVideoPlaying)
  2429.            {
  2430.            return TRUE;
  2431.            }
  2432.       else
  2433.           return FALSE;
  2434.       }
  2435.      else
  2436.       return FALSE;
  2437.  
  2438. }
  2439.  
  2440. BOOL FAR PASCAL SeekAllToStart()
  2441. {
  2442.      HANDLE hLibrary;
  2443.      FARPROC lpfnSeekVFWToStart;
  2444.  
  2445.  
  2446.      hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  2447.  
  2448.      if (hLibrary >= 32)
  2449.           {
  2450.  
  2451.            lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
  2452.  
  2453.            (*lpfnSeekVFWToStart) (lpDevice1->wDeviceID);
  2454.            lpDevice1->bVideoPlaying=FALSE;
  2455.            (*lpfnSeekVFWToStart) (lpDevice2->wDeviceID);
  2456.            lpDevice2->bVideoPlaying=FALSE;
  2457.            (*lpfnSeekVFWToStart) (lpDevice3->wDeviceID);
  2458.            lpDevice3->bVideoPlaying=FALSE;
  2459.            (*lpfnSeekVFWToStart) (lpDevice4->wDeviceID);
  2460.            lpDevice4->bVideoPlaying=FALSE;
  2461.            (*lpfnSeekVFWToStart) (lpDevice5->wDeviceID);
  2462.            lpDevice5->bVideoPlaying=FALSE;
  2463.            (*lpfnSeekVFWToStart) (lpDevice6->wDeviceID);
  2464.            lpDevice6->bVideoPlaying=FALSE;
  2465.            FreeLibrary(hLibrary);
  2466.            }
  2467.  
  2468. return TRUE;
  2469. }
  2470.  
  2471.  
  2472. BOOL FAR PASCAL HideAllWindows()
  2473. {
  2474. ShowWindow( lpDevice1->hWnd, SW_HIDE );
  2475. ShowWindow( lpDevice2->hWnd, SW_HIDE );
  2476. ShowWindow( lpDevice3->hWnd, SW_HIDE );
  2477. ShowWindow( lpDevice4->hWnd, SW_HIDE );
  2478. ShowWindow( lpDevice5->hWnd, SW_HIDE );
  2479. ShowWindow( lpDevice6->hWnd, SW_HIDE );
  2480. ShowWindow( lpDevice7->hWnd, SW_HIDE );
  2481. ShowWindow( lpDevice8->hWnd, SW_HIDE );
  2482. return TRUE;
  2483. }
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489. BOOL FAR PASCAL FreeDevices(hWnd)
  2490. HANDLE hWnd;
  2491. {
  2492. HANDLE hLibrary;
  2493. BOOL bReturn;
  2494. FARPROC lpfnCloseWaveFile;
  2495. FARPROC lpfnCloseWaveDevice;
  2496. FARPROC lpfnCloseVFWFile;
  2497. FARPROC lpfnCloseVFWDevice;
  2498. FARPROC lpfnCloseAllDevices;
  2499. MSG msg;
  2500.  
  2501.       //SeekAllToStart();
  2502.       hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  2503.  
  2504.       if (hLibrary >= 32)
  2505.            {
  2506.         //lpfnCloseAllDevices = GetProcAddress(hLibrary, MAKEINTRESOURCE(20));
  2507.         //bReturn = (*lpfnCloseAllDevices) ();
  2508.  
  2509.         lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  2510.  
  2511.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2512.         if (lpDevice1->wAudioDeviceID)
  2513.               {
  2514.               bReturn = (*lpfnCloseWaveFile) (lpDevice1->wAudioDeviceID);
  2515.               lpDevice1->wAudioDeviceID=0;
  2516.               }
  2517.  
  2518.            // while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2519.         if (lpDevice2->wAudioDeviceID)
  2520.               {
  2521.  
  2522.                bReturn = (*lpfnCloseWaveFile) (lpDevice2->wAudioDeviceID);
  2523.               lpDevice2->wAudioDeviceID=0;
  2524.               }
  2525.  
  2526.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2527.         if (lpDevice3->wAudioDeviceID)
  2528.               {
  2529.               bReturn = (*lpfnCloseWaveFile) (lpDevice3->wAudioDeviceID);
  2530.               lpDevice3->wAudioDeviceID=0;
  2531.               }
  2532.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2533.         if (lpDevice4->wAudioDeviceID)
  2534.               {
  2535.                bReturn = (*lpfnCloseWaveFile) (lpDevice4->wAudioDeviceID);
  2536.               lpDevice4->wAudioDeviceID=0;
  2537.               }
  2538.  
  2539.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2540.  
  2541.         if (lpDevice5->wAudioDeviceID)
  2542.               {
  2543.                bReturn = (*lpfnCloseWaveFile) (lpDevice5->wAudioDeviceID);
  2544.               lpDevice5->wAudioDeviceID=0;
  2545.               }
  2546.  
  2547.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2548.  
  2549.         if (lpDevice6->wAudioDeviceID)
  2550.               {
  2551.                bReturn = (*lpfnCloseWaveFile) (lpDevice6->wAudioDeviceID);
  2552.               lpDevice6->wAudioDeviceID=0;
  2553.               }
  2554.  
  2555.         lpfnCloseWaveDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(19));
  2556.  
  2557.         if (wGlobalAudioDeviceID)
  2558.               {
  2559.                bReturn = (*lpfnCloseWaveDevice) (wGlobalAudioDeviceID);
  2560.                wGlobalAudioDeviceID=0;
  2561.               }
  2562.  
  2563.  
  2564.         lpfnCloseVFWDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(4));
  2565.  
  2566.  
  2567.         lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  2568.  
  2569.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2570.         if (lpDevice1->wDeviceID)
  2571.               {
  2572.                bReturn = (*lpfnCloseVFWFile) (lpDevice1->wDeviceID);
  2573.               lpDevice1->wDeviceID=0;
  2574.               }
  2575.  
  2576.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2577.         if (lpDevice2->wDeviceID)
  2578.               {
  2579.                bReturn = (*lpfnCloseVFWFile) (lpDevice2->wDeviceID);
  2580.                lpDevice2->wDeviceID=0;
  2581.               }
  2582.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2583.  
  2584.         if (lpDevice3->wDeviceID)
  2585.               {
  2586.                bReturn = (*lpfnCloseVFWFile) (lpDevice3->wDeviceID);
  2587.               lpDevice3->wDeviceID=0;
  2588.               }
  2589.  
  2590.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2591.         if (lpDevice4->wDeviceID)
  2592.               {
  2593.                bReturn = (*lpfnCloseVFWFile) (lpDevice4->wDeviceID);
  2594.                lpDevice4->wDeviceID=0;
  2595.               }
  2596.  
  2597.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2598.  
  2599.         if (lpDevice5->wDeviceID)
  2600.               {
  2601.                bReturn = (*lpfnCloseVFWFile) (lpDevice5->wDeviceID);
  2602.                lpDevice5->wDeviceID=0;
  2603.               }
  2604.  
  2605.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2606.         if (lpDevice6->wDeviceID)
  2607.               {
  2608.                bReturn = (*lpfnCloseVFWFile) (lpDevice6->wDeviceID);
  2609.                lpDevice6->wDeviceID=0;
  2610.               }  
  2611.               
  2612.          if (lpDevice9->wDeviceID)
  2613.               {
  2614.                bReturn = (*lpfnCloseVFWFile) (lpDevice9->wDeviceID);
  2615.                lpDevice9->wDeviceID=0;
  2616.               }   
  2617.               
  2618.         //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
  2619.         if (wGlobalDeviceID)
  2620.               {
  2621.                bReturn = (*lpfnCloseVFWDevice) (hWnd,wGlobalDeviceID);
  2622.                wGlobalDeviceID=0;
  2623.               }
  2624.  
  2625.         FreeLibrary(hLibrary);
  2626.  
  2627.         /* grey menu item first */
  2628.         /* enable second */
  2629.         }
  2630. return TRUE;
  2631.  
  2632. }
  2633.  
  2634. BOOL FAR PASCAL CreateVideoWindow(nButton)
  2635. int nButton;
  2636. {
  2637.        HANDLE hVidWnd; 
  2638.        char szIniName[11]; 
  2639.        RECT Points;
  2640.        RECT Points2;
  2641.        HANDLE hLibrary;
  2642.        FARPROC lpfnUpdateVFW;  
  2643.        HDC hTempDC;
  2644.        DLGPROC dlgProc;
  2645.  
  2646.        wsprintf(szIniName,"button%d",nButton);
  2647.        //lstrcpy(szIniName,"playvfw");
  2648.        hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  2649.  
  2650.        if (hLibrary >= 32)
  2651.            {
  2652.         GetVidWinFromIni(lpDevice9,9,&Points,&Points2,hLibrary,szIniName);
  2653.        
  2654.             lpDevice9->hWnd = CreateWindow((LPSTR)"VidWin",
  2655.                                    (LPSTR)"Video Window",
  2656.                                    WS_CHILD | WS_CLIPSIBLINGS,
  2657.                                    Points.left ,    /*  x - ignored for tiled windows */
  2658.                                    Points.top,    /*  y - ignored for tiled windows */
  2659.                                    Points.right,     /* cx - ignored for tiled windows */
  2660.                                    Points.bottom,      /* cy - ignored for tiled windows */
  2661.                                    (HWND)hWndMain,        /*parent */
  2662.                                    (HMENU)NULL,    /* use class menu */
  2663.                                    (HANDLE)hInst, /* handle to window instance */
  2664.                                    (LPSTR)NULL       /* no params to pass on */
  2665.                                    );
  2666.             
  2667.             hWndEdit = CreateWindow((LPSTR)"Edit",
  2668.                                    (LPSTR)"Edit Window",
  2669.                                    WS_CHILD | WS_CLIPSIBLINGS | ES_MULTILINE | ES_AUTOVSCROLL,
  2670.                                    Points.left ,    /*  x - ignored for tiled windows */
  2671.                                    Points.top,    /*  y - ignored for tiled windows */
  2672.                                    Points.right,     /* cx - ignored for tiled windows */
  2673.                                    Points.bottom,      /* cy - ignored for tiled windows */
  2674.                                    (HWND)hWndMain,        /*parent */
  2675.                                    (HMENU)IDC_EDIT,    /* use class menu */
  2676.                                    (HANDLE)hInst, /* handle to window instance */
  2677.                                    (LPSTR)NULL       /* no params to pass on */
  2678.                                    );
  2679.         ReadTextFileIntoEdit();
  2680.  
  2681.             lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
  2682.  
  2683.         hTempDC=GetDC(lpDevice9->hWnd);
  2684.  
  2685.         (*lpfnUpdateVFW) (lpDevice9->wDeviceID,hTempDC);
  2686.  
  2687.         ReleaseDC(lpDevice9->hWnd,hTempDC);
  2688.  
  2689.             ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL ); 
  2690.             
  2691.             dlgProc=(DLGPROC)MakeProcInstance(ButtonBarProc,hInst);
  2692.             
  2693.         hWndButtonBar=CreateDialog(hInst,MAKEINTRESOURCE(BUTTONBAR),hWndMain,dlgProc);
  2694.  
  2695.         SetWindowPos(hWndButtonBar,(HWND) NULL,Points2.left,Points2.top,Points2.right,Points2.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
  2696.  
  2697.         ShowWindow(hWndButtonBar,SW_SHOW);
  2698.             
  2699.             FreeLibrary(hLibrary);
  2700.            }
  2701.      return FALSE;
  2702. }
  2703.  
  2704. BOOL FAR PASCAL GetVidWinFromIni(lpDevice,nButton,lpPoints,lpPoints2,hLibrary,lpIniName)
  2705. LPDEVICESTRUCT lpDevice;
  2706. int nButton;
  2707. LPRECT lpPoints;
  2708. LPRECT lpPoints2;
  2709. HANDLE hLibrary;
  2710. LPSTR lpIniName;
  2711. {
  2712.      HANDLE hBuffer;
  2713.      LPSTR lpBuffer;
  2714.  
  2715.      HANDLE hSection;
  2716.      LPSTR lpSection;
  2717.  
  2718.      HANDLE hFileName;
  2719.      LPSTR lpFileName;
  2720.  
  2721.      HANDLE hEntry;
  2722.      LPSTR lpEntry;
  2723.  
  2724.      HANDLE hAlias;
  2725.      LPSTR  lpAlias;
  2726.  
  2727.      HANDLE hExeName;
  2728.      LPSTR lpExeName;
  2729.  
  2730.      int  nSize;
  2731.      int nBytes;
  2732.      int nAviFile;
  2733.      int nAudioFile;
  2734.      FARPROC lpfnOpenVFWFile;
  2735.      FARPROC lpfnOpenWaveFile;
  2736.      FARPROC lpfnCloseVFWFile;
  2737.      FARPROC lpfnCloseWaveFile;
  2738.  
  2739.      BOOL bReturn;
  2740.  
  2741.      nAviFile=1;
  2742.      nAudioFile=1;
  2743.  
  2744.      hBuffer=GlobalAlloc(GHND,80);
  2745.      hSection=GlobalAlloc(GHND,10);
  2746.      hFileName=GlobalAlloc(GHND,128);
  2747.      hEntry=GlobalAlloc(GHND,20);
  2748.      hAlias=GlobalAlloc(GHND,20);
  2749.      hExeName=GlobalAlloc(GHND,10);
  2750.  
  2751.      if (hBuffer && hSection && hFileName && hEntry)
  2752.       {
  2753.        lpBuffer=GlobalLock(hBuffer);
  2754.        lpSection=GlobalLock(hSection);
  2755.        lpFileName=GlobalLock(hFileName);
  2756.        lpEntry=GlobalLock(hEntry);
  2757.        lpAlias=GlobalLock(hAlias);
  2758.        lpExeName=GlobalLock(hExeName);
  2759.  
  2760.        if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
  2761.            {
  2762.         nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
  2763.         if(nBytes)
  2764.              {
  2765.               wsprintf(lpSection,"Button%d",nButton);
  2766.               ExtractExtension(lpFileName,lpExeName); 
  2767.               
  2768.               lstrcat(lpFileName,lpIniName);
  2769.               // put in check for a exe file already 8 characters long.
  2770.               //lstrcat(lpFileName,"2");
  2771.               lstrcat(lpFileName,".ini");
  2772.  
  2773.               wsprintf(lpEntry,"AVI File%d",nAviFile);
  2774.               nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2775.               if(!nSize)
  2776.                 {
  2777.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2778.                 return FALSE;
  2779.                 }
  2780.  
  2781.               StripSpaces(lpBuffer);
  2782.  
  2783.               
  2784.               wsprintf(lpAlias,"%s%d","VidWin");
  2785.  
  2786.               lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
  2787.  
  2788.               lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
  2789.  
  2790.                if (!lpDevice->wDeviceID)
  2791.                 {
  2792.                 ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
  2793.                 return FALSE;
  2794.                 }
  2795.  
  2796.               
  2797.  
  2798.                wsprintf(lpEntry,"Position%d",nAviFile);
  2799.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2800.                if(!nSize)
  2801.                 {
  2802.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2803.                 return FALSE;
  2804.                 }
  2805.  
  2806.                StripSpaces(lpBuffer);
  2807.                ReturnCoor(lpBuffer,lpPoints);
  2808.  
  2809.                lstrcpy(lpEntry,"ControlPos");
  2810.                nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
  2811.                if(!nSize)
  2812.                 {
  2813.                 ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
  2814.                 return FALSE;
  2815.                 }
  2816.  
  2817.                StripSpaces(lpBuffer);
  2818.                ReturnCoor(lpBuffer,lpPoints2);
  2819.                
  2820.  
  2821.              } // End if nBytes
  2822.         } // End of if the memory locks succeded.
  2823.       else
  2824.            {
  2825.            MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
  2826.            }
  2827.       } // End of if the memory allocations succeded.
  2828.      else
  2829.       MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
  2830.  
  2831.  
  2832.     GlobalUnlock(hFileName);
  2833.     GlobalUnlock(hSection);
  2834.     GlobalUnlock(hBuffer);
  2835.     GlobalUnlock(hEntry);
  2836.     GlobalUnlock(hAlias);
  2837.     GlobalUnlock(hExeName);
  2838.  
  2839.     GlobalFree(hFileName);
  2840.     GlobalFree(hSection);
  2841.     GlobalFree(hBuffer);
  2842.     GlobalFree(hEntry);
  2843.     GlobalFree(hAlias);
  2844.     GlobalFree(hExeName);
  2845.  
  2846. return TRUE;
  2847. }
  2848.  
  2849.  
  2850. /* Procedures which make up the window class. */
  2851. long FAR PASCAL VideoWndProc( hWnd, message, wParam, lParam )
  2852. HWND hWnd;
  2853. unsigned message;
  2854. WORD wParam;
  2855. LONG lParam;
  2856. {  
  2857.      switch (message)
  2858.            {
  2859.             case WM_CREATE:
  2860.  
  2861.             break;
  2862.  
  2863.             case WM_SYSCOMMAND:
  2864.                    switch (wParam)
  2865.                           {
  2866.  
  2867.                           
  2868.                             default:
  2869.                                    return DefWindowProc( hWnd, message, wParam, lParam );
  2870.  
  2871.                             }
  2872.              break;
  2873.  
  2874.              case WM_COMMAND:
  2875.              break;  
  2876.              
  2877.              case WM_DESTROY:
  2878.  
  2879.                    PostQuitMessage( 0 );
  2880.              break;
  2881.  
  2882. //    case WM_PAINT:
  2883.  
  2884.  
  2885. //      BeginPaint( hWnd, (LPPAINTSTRUCT)&ps );
  2886. //      PlayVFWPaint( ps.hdc );
  2887. //      EndPaint( hWnd, (LPPAINTSTRUCT)&ps );
  2888. //      break;
  2889.  
  2890.              default:
  2891.                    return DefWindowProc( hWnd, message, wParam, lParam );
  2892.               break;
  2893.             }
  2894.       return(0L);
  2895.              
  2896. }
  2897.  
  2898. BOOL FAR PASCAL _export ButtonBarProc( hDlg, message, wParam, lParam )
  2899. HWND hDlg;
  2900. unsigned message;
  2901. WORD wParam;
  2902. LONG lParam;
  2903. {
  2904.  
  2905. HANDLE hLibrary; 
  2906. FARPROC lpfnPlayVFWFile;
  2907. FARPROC lpfnStopVFWFile;
  2908. FARPROC lpfnPauseVFWFile;
  2909. FARPROC lpfnStepVFWReverse;
  2910. FARPROC lpfnStepVFW;     
  2911. FARPROC lpfnResumeVFWFile;    
  2912. FARPROC lpfnSeekVFWToStart;
  2913. static BOOL bIsPaused;    
  2914.  
  2915.  
  2916.     switch (message)
  2917.          {  
  2918.          case WM_INITDIALOG:
  2919.               bIsPaused=FALSE;
  2920.          break;
  2921.          
  2922.          case WM_COMMAND: 
  2923.               { 
  2924.               hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  2925.  
  2926.               if (hLibrary >= 32)
  2927.                    {
  2928.                     switch (wParam)
  2929.                          {
  2930.               case ID_PLAY:
  2931.                 ShowWindow( hWndEdit, SW_HIDE );
  2932.                 ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
  2933.  
  2934.                                 if (bIsPaused)
  2935.                                      {
  2936.                                       lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
  2937.                                       (*lpfnResumeVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
  2938.                                       bIsPaused=FALSE;
  2939.                                       }
  2940.                                  else
  2941.                                       {
  2942.                                       lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
  2943.                                       (*lpfnPlayVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
  2944.                                       }     
  2945.                           break;
  2946.                      
  2947.                           case ID_STOP:  
  2948.                                 lpfnStopVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(23));
  2949.                                 (*lpfnStopVFWFile) (lpDevice9->wDeviceID);
  2950.                                 
  2951.                           break;
  2952.                      
  2953.                           case ID_PAUSE:  
  2954.                                 if (bIsPaused)
  2955.                                      {
  2956.                                       lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
  2957.                                       (*lpfnResumeVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
  2958.                                       bIsPaused=FALSE;
  2959.                                       }
  2960.                                  else    
  2961.                                       {
  2962.                                       lpfnPauseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(12));
  2963.                                       (*lpfnPauseVFWFile) (lpDevice9->wDeviceID);
  2964.                                       bIsPaused=TRUE;
  2965.                                       }
  2966.                           break;
  2967.                      
  2968.                           case ID_REWIND:
  2969.                                
  2970.                                  lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
  2971.                                  (*lpfnSeekVFWToStart) (lpDevice9->wDeviceID);
  2972.                           break;
  2973.                      
  2974.                           case ID_FORWARD: 
  2975.                                  lpfnStepVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(21));
  2976.                                 (*lpfnStepVFW) (lpDevice9->wDeviceID,5);
  2977.                           break;  
  2978.                           
  2979.                           case ID_BACK:
  2980.                                 lpfnStepVFWReverse = GetProcAddress(hLibrary, MAKEINTRESOURCE(22));
  2981.                                 (*lpfnStepVFWReverse) (lpDevice9->wDeviceID);
  2982.                                  
  2983.                           break;
  2984.                           }
  2985.                      FreeLibrary(hLibrary);     
  2986.                     }      
  2987.                }
  2988.           break;           
  2989.           
  2990.           default:
  2991.               return FALSE;
  2992.           }   
  2993.           
  2994. return FALSE;
  2995.  
  2996. BOOL FAR PASCAL DoPage1()
  2997.  
  2998. {   
  2999.     FARPROC lpfnCloseWaveFile;
  3000.     FARPROC lpfnCloseVFWFile;
  3001.     HANDLE hLibrary;
  3002.     BOOL bReturn;
  3003.     
  3004.     hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
  3005.  
  3006.     if (hLibrary >= 32)
  3007.          {
  3008.          bIsPage0=FALSE;
  3009.          bIsPage1=TRUE;
  3010.  
  3011.          ShowWindow(lpDevice1->hWnd,SW_SHOWNORMAL);
  3012.          ShowWindow(lpDevice2->hWnd,SW_SHOWNORMAL);
  3013.          ShowWindow(lpDevice3->hWnd,SW_SHOWNORMAL);
  3014.          ShowWindow(lpDevice4->hWnd,SW_SHOWNORMAL);
  3015.          ShowWindow(lpDevice5->hWnd,SW_SHOWNORMAL);
  3016.          ShowWindow(lpDevice6->hWnd,SW_SHOWNORMAL);
  3017.          ShowWindow(lpDevice7->hWnd,SW_HIDE);
  3018.  
  3019.          lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
  3020.  
  3021.          bReturn = (*lpfnCloseWaveFile) (lpDevice7->wAudioDeviceID);
  3022.          lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
  3023.  
  3024.  
  3025.          bReturn = (*lpfnCloseVFWFile) (lpDevice7->wDeviceID); 
  3026.          FreeLibrary(hLibrary);
  3027.          }      
  3028.          
  3029.     return TRUE;
  3030. }
  3031.  
  3032.  
  3033. BOOL FAR PASCAL ReadTextFileIntoEdit()
  3034. {
  3035.      OFSTRUCT pof;
  3036.      HANDLE hFile;
  3037.      int nBytes;
  3038.      int bytes;
  3039.      LPSTR lpFileName;
  3040.      HANDLE hFileName;
  3041.      HANDLE hExeName;
  3042.      HANDLE hBuffer;
  3043.      LPSTR lpExeName;
  3044.      LPSTR lpBuffer;
  3045.      LPSTR lpTmpBuf;
  3046.      int i;
  3047.  
  3048.      hFileName=GlobalAlloc(GHND,128);
  3049.      hExeName=GlobalAlloc(GHND,10);
  3050.      hBuffer=GlobalAlloc(GHND,80+1);
  3051.      if (hFileName && hExeName && hBuffer)
  3052.     {
  3053.      lpFileName=GlobalLock(hFileName);
  3054.      lpExeName=GlobalLock(hExeName);
  3055.      lpBuffer=GlobalLock(hBuffer);
  3056.      if(lpFileName && hExeName && hBuffer)
  3057.            {
  3058.         nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
  3059.         if(nBytes)
  3060.               {
  3061.                ExtractExtension(lpFileName,lpExeName);
  3062.  
  3063.                if(!lstrlen(lpDevice1->szFileName))
  3064.                 {
  3065.                 MessageBox(hWndMain,"Text File Name is invalid","ERROR",MB_OK);
  3066.                 return FALSE;
  3067.                 }
  3068.  
  3069.                lstrcat(lpFileName,lpDevice1->szFileName);
  3070.                hFile=OpenFile(lpFileName,&pof,OF_READWRITE);
  3071.  
  3072.                if (hFile==-1)
  3073.                 {
  3074.                 MessageBox(hWndMain,"Unable to open File","Check that text file exists",MB_OK);
  3075.                 return FALSE;
  3076.                 }
  3077.  
  3078.                _llseek (hFile,0L,0);
  3079.  
  3080.                bytes=_lread(hFile,lpBuffer,80);
  3081.  
  3082.                while(bytes==80)
  3083.                  {
  3084.                   lpTmpBuf=lpBuffer;
  3085.  
  3086.                   for(i=0;i<80;++i)
  3087.                    ++lpTmpBuf;
  3088.  
  3089.                   *lpTmpBuf='\0';
  3090.  
  3091.                   //nLength=SendMessage(hWndEdit,EM_GETLINE,wLine,lpBuffer);
  3092.                   SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
  3093.                   bytes=_lread(hFile,lpBuffer,80);
  3094.  
  3095.                   }
  3096.  
  3097.             if (bytes>0)
  3098.                 {
  3099.                   lpTmpBuf=lpBuffer;
  3100.  
  3101.                   for(i=0;i<bytes;++i)
  3102.                    ++lpTmpBuf;
  3103.  
  3104.                   *lpTmpBuf='\0';
  3105.  
  3106.                 SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
  3107.                 }
  3108.                }// if nBytes
  3109.           else
  3110.               {
  3111.               MessageBox(hWndMain,"couldn't get pathname","ERROR",MB_OK);
  3112.               return FALSE;
  3113.               }
  3114.            }// if global lock
  3115.     else
  3116.            {
  3117.            MessageBox(hWndMain,"Global Lock Failed","ERROR",MB_OK);
  3118.            return FALSE;
  3119.            }
  3120.     }// if global alloc
  3121.      else
  3122.     {
  3123.     MessageBox(hWndMain,"Global Alloc failed","ERROR",MB_OK);
  3124.     return FALSE;
  3125.     }
  3126.      return TRUE;
  3127. }
  3128.